You need to sign in to do that
Don't have an account?
Etienne Gaudry 5
i have this response, ty for helping :
401 API
Hi, i try to make a post API call.
On Postman with the wrapper and the token of my method, my api call work. The endpoint is good too. But on apex i have 401 error.
I think my SetHeader is bad :
request.setHeader('Authorization', 'oAuth 2.0 ' + accToken); request.setHeader('Content-Type', 'application/json'); request.setHeader('Accept','*/*'); request.setBody(JSON.serialize(resWrap)); request.setMethod('POST'); request.setEndpoint(endPoint); HttpResponse hresponse = htt.send(request); system.debug(hresponse);
i have this response, ty for helping :
System.HttpResponse[Status=Non-Autorisé, StatusCode=401]
Please modify 1st line like below,
request.setHeader('Authorization','Bearer '+accToken);
it should be bearer and not oAuth 2.0
Please let us know, if this helps.
Thanks,
Govindaraj.S