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 Answers 2

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.

3
  • 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
    Commented Mar 20, 2016 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
    Commented Mar 20, 2016 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.) Commented Mar 21, 2016 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.

You must log in to answer this question.

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