You need to sign in to do that
Don't have an account?
cvsg
Using web services session id and access token interchangeably
Hi,
I have a generated a sessionID using web services API (login call) and trying to use it as an accesstoken in a REST based request. It doesn''t seem to be working. Here is the link to documentation which talks about this. http://www.salesforce.com/us/developer/docs/api_rest/index_Left.htm#StartTopic=Content/quickstart_oauth.htm
any help is appreciated
Thanks,
cvsg
I do it all the time, can you post some more details on how its not working, what does your REST API request look like ?
hi,
I use the below code.
HttpClient httpclient = new HttpClient();
GetMethod method = new GetMethod(https://ap1.salesforce.com/services/data/v20.0/sobjects/);
method.setRequestHeader("Authorization", "OAuth "+ <sessioind generated from web servics api>);
method.setRequestHeader("Accept-Encoding", "gzip");
httpclient.executeMethod(method);
What error do you get? is your org actually on ap1 ?
Hi,
I just found out where thr problem is. The problem is with serverurl retrieved from the loginresult object. It is in the format https://<servername>/services/Soap/u/20.0/00D900000000mBf. To create a REST based url, I am blindly appending "/services/data/v20.0/sobjects/" to the server url. I guess, I will have to parse the server url for server name and then append rest related paths to that.
Anyway, thanks a lot!
cvsg.