I recently had a question on how to query a list of products from a pricebook and was told that i could use the below to do so

[SELECT Id, Product2Id, Product2.Name FROM PricebookEntry WHERE Pricebook2Id='12345']

As I am using React to display these data (its a menu btw) I would like to know how I can query them in the below component

import React, { useState, useEffect } from 'react';
import axios from 'axios';

function Menu() {
    useEffect(async () => {
        const result = await axios({
            method: 'get',
            data: {
                fields: 'Name'
            headers: {
                    'Bearer 00D2X000001esWS!ASAAQFt1nPdywlTPnqeFBF7WSQdKKX9nKdrwrc2V9WOv3tuOFHyJ0cuq8PA4rn1'

    }, []);

    return <ul />;

export default Menu;

any help would be welcome as I am very new to SF :)

1 Answer 1


If you want to do a query, your endpoint should be /services/data/v48.0/query

For example:


See the doc


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .