You need to sign in to do that
Don't have an account?

I am trying to call api of salesforce but I am getting an error as Invalid session id
When I call the api like this, https://xx.salesforce.com/services/data/v36.0/sobject/ I am getting an error like this
Please see the image for reference
Here is a way to get session Id
Make a call using
URL: https://test.salesforce.com/services/Soap/u/36.0
Headers:
Content-Type:text/xml; charset=UTF-8
SOAPAction:""
Method: Post
Request body:
<?xml version="1.0" encoding="utf-8" ?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:login xmlns:n1="urn:partner.soap.sforce.com"><n1:username>yourusername@username.com</n1:username><n1:password>YourPasswordYourSecurityKey</n1:password></n1:login></env:Body></env:Envelope>
The response will have Session Id. Use the session ID in your request like this
URL: https://xx.salesforce.com/services/data/v36.0/sobject
Headers:
Content-Type:text/xml; charset=UTF-8
Authorization:Bearer YourSessionId
Method: GET
All Answers
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Here is a way to get session Id
Make a call using
URL: https://test.salesforce.com/services/Soap/u/36.0
Headers:
Content-Type:text/xml; charset=UTF-8
SOAPAction:""
Method: Post
Request body:
<?xml version="1.0" encoding="utf-8" ?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><n1:login xmlns:n1="urn:partner.soap.sforce.com"><n1:username>yourusername@username.com</n1:username><n1:password>YourPasswordYourSecurityKey</n1:password></n1:login></env:Body></env:Envelope>
The response will have Session Id. Use the session ID in your request like this
URL: https://xx.salesforce.com/services/data/v36.0/sobject
Headers:
Content-Type:text/xml; charset=UTF-8
Authorization:Bearer YourSessionId
Method: GET