0

I am trying to run the following SOQL query using POSTMAN but i am getting the following error. I have used the access token in the following statement.

SOQL Query:

https://ap1.salesforce.com/services/data/v29.0/query/?q=SELECT+Id+from+Account -H "Authorization:Bearer 00D90000000rBwy! ARIAQB2opHNgIk3xbxx83k3letsZYb8siO2slRTDQAhlFsUV1ov_nkKOdxapsHkj8RYF5ZqRG7q1eGCynmdIqNAVdKwFNXDM"

Error:

[ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ]

I have the access token which i generated in the same session and used the same tab in Google Chrome.

enter image description here

But if i use the headers and specify the access token and content type in the headers then it worked correctly. Could someone please advice what is the issue in the first approach that is specifying the access token in the URL itself? Thanks.

2

The first format, using -H, is for a curl command line command. You wouldn't use that format in postman, because that will cause it to appear in the query string.

  • Thanks @sfdcfox. Can you please suggest a url format of executing SOQL in postman without specifying the headers separately? – Bforce Nov 19 '14 at 6:42
  • @BaskaranS The headers are required, because is how authentication works in salesforce.com. The "-H" parameter in curl also produces a header, but since it's a command-line interface, you don't see it as such. – sfdcfox Nov 19 '14 at 15:25
  • Thanks @sfdcfox. I understood now. Thanks again for the clarification. – Bforce Nov 19 '14 at 16:13
2

But if i use the headers and specify the access token and content type in the headers then it worked correctly. Could someone please advice what is the issue in the first approach that is specifying the access token in the URL itself? Thanks.

There is no issue. It is supposed to be in the header.

  • 1
    The OP is confusing documentation for postman and curl. – sfdcfox Nov 18 '14 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.