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',
url:
'https://tahina-test2-dev-ed.my.salesforce.com/services/data/v20.0/sobjects/Pricebook2/01s2X0XyrMQAS',
data: {
fields: 'Name'
},
headers: {
Authorization:
'Bearer 00D2X000001esWS!ASAAQFt1nPdywlTPnqeFBF7WSQdKKX9nKdrwrc2V9WOv3tuOFHyJ0cuq8PA4rn1'
}
});
console.log(result.data);
}, []);
return <ul />;
}
export default Menu;
any help would be welcome as I am very new to SF :)