+ Start a Discussion
cwoodcwood 

Linking to the correct instance from an API client

My app uses the SOAP API and I want to create links back to the Salesforce.com application. I understand that I need to get the server name for the link target from the serverUrl field in th LoginResult, but that field contains (for me anyway) "na1-api.salesforce.com". Shouldn't I be building links to na1, not na1-api?

If I use the hostname from the LoginResult, I build a link that looks like https://na1-api.salesforce.com/00Q30000006xrFvEAI, which forces me to (re-)authenticate even if my browser has an active session. (If I pase that link back in the address bar, I'm forced to re-authenticate again.)

If I instead use "na1.salesforce.com", I'm not forced to re-authenticate, which is the desired behavior.

Can I get the hostname from LoginResult and strip "-api" from it? Will this work with EMEA and AP?

Thanks,
Charlie

Message Edited by cwood on 04-10-2006 01:38 PM

JesterJester
Well you could strip "-api", but who knows if they will change that someday.

I say use either the urlDetail, urlEdit, or urlNew values from the DescribeSObjectCall.  By design they are meant to point you inside the website.

Cha-ching.
cwoodcwood
Oh yeah--urlDetail. I used to know that, then I forgot it. Weird! But now I remember why I'm not using it: my app uses the older version of the PHP toolkit that uses v2.5 of the SOAP API, which doesn't include urlDetail in the DescribeSObjectResult object.

Yes, I know I should move to the new PHP 5.1 toolkit, but that requires infrastructure changes on the server, which aren't going to happen any time soon.

So I suppose what I'm looking for is a way to construct what exactly what urlDetail would return but using v2.5 of the SOAP API. Suggestions?

-Charlie

Message Edited by cwood on 04-10-2006 02:20 PM