Salesforce does not allow access to the Authorization header.
If you are using the a Salesforce login with OAuth use UserInfo.getSessionId() to get the Authorization data.
I created a public REST service that uses a shared key for authorization. As a workaround I added a custom header called AuthorizationToken. By checking to ensure this is present and valid I can authorize a call.
You can definitely use workbench to execute these
Use the below for the request
/services/data/v34.0/composite/tree/Account
and in the body use the below JSON
{
"records" :[{
"attributes" : {"type" : "Account", "referenceId" : "ref1"},
"name" : "SampleAccount1",
"phone" : "1111111111",
"website" : "www.salesforce1.com",
"numberOfEmployees" : "100",
"industry" : "Banking"
},{
"attributes" : {"type" : "Account", "referenceId" : "ref2"},
"name" : "SampleAccount2",
"phone" : "2222222222",
"website" : "www.salesforce2.com",
"numberOfEmployees" : "250",
"industry" : "Banking"
},{
"attributes" : {"type" : "Account", "referenceId" : "ref3"},
"name" : "SampleAccount3",
"phone" : "3333333333",
"website" : "www.salesforce3.com",
"numberOfEmployees" : "52000",
"industry" : "Banking"
},{
"attributes" : {"type" : "Account", "referenceId" : "ref4"},
"name" : "SampleAccount4",
"phone" : "4444444444",
"website" : "www.salesforce4.com",
"numberOfEmployees" : "2500",
"industry" : "Banking"
}]
}
You should see the response in workbench
Alternatively you can use POSTMAN to experiment with this API .
You will need to create a connected app in salesforce and use oauth 2.0 to get access token for subsequent calls
use the below link for reference
Best Answer
This is a duplicate of Authorization header missing from RestRequest headers map
Salesforce does not allow access to the Authorization header.
If you are using the a Salesforce login with OAuth use UserInfo.getSessionId() to get the Authorization data.
I created a public REST service that uses a shared key for authorization. As a workaround I added a custom header called AuthorizationToken. By checking to ensure this is present and valid I can authorize a call.