4

Is there a way for me to get salesforce instance URL from Java?

I was looking for something similar to System.Url.getSalesforceBaseUrl() in Apex, but I couldn't find anything suitable in Metadata or SOAP API.

6

When you call the Partner API login() method it will return a LoginResult. It will have the:

  • serverUrl

    URL of the endpoint that will process subsequent API calls. Your client application needs to set the endpoint.

and

  • metadataServerUrl.

    URL of the endpoint that will process subsequent metadata API calls. Your client application needs to set the endpoint.

If you already have the serverUrl then you can just take the domain part of it.

| improve this answer | |
  • Thank you, this is what I was looking for. Let me do some tweaks in my code – currently, when I do 'login()', 'PartnerConnection' is returned instead of 'LoginResult'... – wintermute Jul 7 '16 at 22:23

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.