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


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',

        data: {
            fields: 'Name'
        headers: {

can anyone help?

  • Please don't post a bearer token on a public site. It is just as valuable as a password, and may compromise your account. I suggest deleting the session Id from setup as soon as possible.
    – sfdcfox
    Jul 1, 2020 at 23:46
  • Hi mate, thats was a mistake on my part. Thank you for the head up :) for now its alright since its a dummy app :) Would you be able to answer my question btw?
    – Kisho
    Jul 1, 2020 at 23:48

1 Answer 1


There shouldn't be a payload here:

    data: {
        fields: 'Name'

This is because you can't use GET with a HTTP Body.

Remove that and your code should work fine.


Your query is also missing the quotes:

  • Afraid not, still get a 400 :/
    – Kisho
    Jul 2, 2020 at 0:00
  • @Kisho I see the quotes appear to be missing. Try that.
    – sfdcfox
    Jul 2, 2020 at 0:03
  • That was indeed the issue. I used backticks and added the Pricebook2Id in quotes as such- url: https://tahina-test2-dev-ed.my.salesforce.com/services/data/v48.0/query?q=SELECT+Product2Id,+Product2.Name+from+Pricebookentry+WHERE+Pricebook2Id='01s2X000002X6PxQAK', Thank you for you help :)
    – Kisho
    Jul 2, 2020 at 0:06
  • @Kisho glad to help!
    – sfdcfox
    Jul 2, 2020 at 0:23

You must log in to answer this question.

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