2

I have completed OAuth for a Salesforce customer, and I have their access_token and refresh_token.

But how do I know what API URL to call on their behalf? I.e. https://na16.salesforce.com/services/data/v36.0/ or https://na30.salesforce.com/services/data/v36.0/

I don't want to run any Apex code, or have them manually look at their address bar. Is there some way to get this through the API or OAuth process?

2

Use https://login.salesforce.com/services/data/v36.0/

remaing part Salesforce will handle itself.Salesforce will decide where he need to redirect user.

Note: if you are using SB then use test instead of login.

| improve this answer | |
  • I get this error back from Salesforce with that URL: "Destination URL not reset. The URL returned from login must be set". It appears I need to download data loader to fix this, but I can't see it in my Setup -> Data Management options. – skunkwerk Mar 20 '16 at 15:27
  • I get an "instance_url" back from Salesforce during OAuth, which is "na30.salesforce.com" - should I use that, with /services/data/v36.0/ appended to it? – skunkwerk Mar 20 '16 at 15:57
  • if it will not change in future(You are not thinking to use it in package then you can try this. Store this URL in some place and then use.) – Tushar Sharma Mar 21 '16 at 5:24
2

During OAuth, the instance_url is returned as a parameter. You can just use that, with instance_url + 'services/data/v36.0/' as the complete URL.

| improve this answer | |

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.