Im rather new to SG and is trying to fetch some data.
What I want to do in a nutshell is fetch all the Pricebookentry that match a certain Pricebook2Id. I tried the below query for this on the workbench and it worked
/services/data/v48.0/query?q=SELECT+Product2Id,+Product2.Name+from+Pricebookentry+WHERE+Pricebook2Id='01s2X000002X6PxQAK'
the issue is that I get a bad request (400) when I try to call this in my React component (I'm a front end dev). Below is the code.
const result = await axios({
method: 'get',
url:
'https://tahina-test2-dev-ed.my.salesforce.com/services/data/v48.0/query?q=SELECT+Product2Id,+Product2.Name+from+Pricebookentry+WHERE+Pricebook2Id=01s2X000002X6PxQAK',
data: {
fields: 'Name'
},
headers: {
Authorization:
'<redacted>'
}
});
can anyone help?