I have below cURL:
curl https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "<Client-Id>:<Secret>" \
-d "grant_type=client_credentials".
I want it to be in Http request model as below :
req.setEndpoint('https://api.sandbox.paypal.com/v1/oauth2/token');
req.setMethod('POST');
req.setHeader('Content-Type','application/x-www-form-urlencoded');
req.setBody('grant_type=client_credentials&<Client-Id>:<Secret>'); //replaced clientid and secret with the values from sandbox.
But i am getting below code as response : HttpResponse[Status=Not Acceptable, StatusCode=406]
Can any one point me what was the issue.