1

I'm trying to interact with Metadata API from Python, for multiple different Salesforce accounts / organizations.

I'm using OAuth flow so nobody needs to give me their username + password, and can just reuse the OAuth process we went through for use with REST API.

The docs say that the login request (which uses username + password) is how you get the sessionID and Metadata API server url in order to make subsequent requests. The docs (e.g. here) say you can use OAuth instead, and replace sessionID with the access token you get from OAuth.

But what about the other part, the server url? If OAuth replaces that login request, how can I get this Metadata API server url (or make requests without it, or whatever)?

3

The Server URLs for the various APIs are easy enough to move between:

  • Enterprise API:
    https://server-api.salesforce.com/services/Soap/c/27.0/orgId
  • Partner API:
    https://server-api.salesforce.com/services/Soap/u/27.0/orgId
  • Metadata API:
    https://server-api.salesforce.com/services/Soap/m/27.0/orgId
    Note this is easy to get using the LoginResult.metadataServerUrl
  • Apex API:
    https://server-api.salesforce.com/services/Soap/s/27.0
  • Tooling API:
    https://server-api.salesforce.com/services/Soap/T/27.0/orgId

If coming from an OAuth flow, look for the instance_url that you can use as the basis for the SOAP urls.

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.