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.

1 Answer 1

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.

1
  • 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
    Commented Jul 7, 2016 at 22:23

You must log in to answer this question.

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