You need to sign in to do that
Don't have an account?

How to make httprequest with access token with example
Hi all,
Please any one send me the exact code for httprequest with accesstoken to retrive one org date from anothe org. I am sing this but geting respone as Invalid Token (but i ma puting the correct access token). So tell me what i am doing wrong in below code:
httprequest hreq=new httprequest();//https://login.salesforce.com/id/00D90000000aSjoEAE/00590000000eb7cAAAhreq.Setendpoint('https://ap1.salesforce.com');hreq.setmethod('GET');hreq.setHeader('Authorization: OAuth ', '00D90000000aSjo!AQgAQNfbCS3aunHX37ko2VhwXzk4holpYFrU9juuCIMdanXC54DAjI916nYNvzZHjOV2vRubCiT1XZGeongMBAVxtdMfpLlN');//hreq.setHeader('Content-Type', 'text/xml;charset=UTF-8');hreq.setHeader('SOAPAction','');hreq.setHeader('Host','https://ap1.salesforce.com');http htp=new http();httpResponse res=htp.send(hreq);system.debug('%%%%%%%%%%%%%' +res);System.debug('@@@@@@@@' +res.getBody());
Please help me on this.
Hi Ashish,
Please find enclosed the exact code as desired by you:-
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi Ashish,
Please find enclosed the exact code as desired by you:-
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
hi,
Did this problem solved? I'm suffering the same issue. I got access token via password stream, but when I add it with "Authorization:OAuth XXXXX" into http header and post a request to the instance_url, server returns: "INVALID TOKEN"(1073)
So what happend? what shall I do next?
my problem is solved ;)
Thanks to the hint of endpoint. I checked my program again and found my endpoint path only contains instance_url. When I construct the path rightly, the packet works ok.
It's very confused when the endpoint is wrong but server return invalid token, though.