You need to sign in to do that
Don't have an account?
How to pass access token when getting Report data
Hi Simon,
I'd like to get Salesforce Report data with access token. I used HttpClient to setup connection to Salesforce and send request to get report data. In request header, I used cookies and add 'sid' to it. It works well. However, when I switch to OAuth it doesn't work since then. I tried assigning access token to 'sid' as well as removing 'sid' from header and adding 'Authorization: OAuth #access token#' to header of the request without success. The response code is 200 though. The response is a page with redirect to 'https://login.salesforce.com/?ec=302&startURL=/00O50000002HVb2?isExcel=1&xf=csv&export=1&enc=UTF-8'. Following are the codes for sending the request.
GetMethod get = new GetMethod(url); get.setFollowRedirects(true); get.setRequestHeader("Cookie", "com.salesforce.LocaleInfo=us; inst=APP7"); get.setRequestHeader("Authorization: OAuth ", accessToken); int iCode = client.executeMethod(get);
Please help take a look, and help to point out what could be wrong.
Thanks,
Michael
Here is the curl script that i used for simulating the call.
And following is the response:
Sorry, there's no supported API for accessing report data.
Do you mean there is no supported Webservice API for accessing report data? I'm not using webservice API for report data. I use http connection to request for report data.
it works if i pass session id as sid in request header. It doesn't work if I pass access token as 'Authorization: OAuth #access_token#' in request header. So the question is can i use access token to access report data. if so, how can i do that?
Thanks,
Michael
No, you cannot. You need a full Salesforce.com Session ID.