Kindly suggest me where I'm I going wrong, It works perfectly fine in cURL but when i try doing in in salesforce I'm facing all these Issues
This is My cURL
curl -H "Authorization:Bearer 7512d7f8-2706-4dcd-a288-af482fb728ca" -H "Content-Type: application/json" -d '{"filter" :{}}' https://sandbox-api.flipkart.net/sellers/orders/search
Equivalent Http method
My Access Token : 7512d7f8-2706-4dcd-a288-af482fb728ca
public static void new_version(){
string tok = 'https://sandbox-api.flipkart.net/sellers/orders/search';
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setTimeout(60*1000);
req.setEndpoint(tok);
Blob headerValue = Blob.valueOf('7512d7f8-2706-4dcd-a288-af482fb728ca');
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization' + 'Bearer', authorizationHeader);
req.setHeader('Content-Type', 'application/json');
system.debug('@@@@@@@'+req);
Http h = new Http();
String resp;
HttpResponse res = h.send(req);
resp = res.getBody();
system.debug('@@@@@@@@@@'+res);
}
Error Which I'm facing
System.HttpResponse[Status=Unauthorized, StatusCode=401]