function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
trick012trick012 

Rest API

 

Hi Friends,

 

Can somebody please explain me what is happening in the below given lines.

 

What is header and why do we use it.?

What does this EncodingUtil.base64Encode does?

 

What is the use of Blob.valueof()?.

 

 

 

String username = 'myname';
String password = 'mypwd';
 
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);

 

 

Thanks,

Trick

dkadordkador

Check out wikipedia: http://en.wikipedia.org/wiki/Basic_access_authentication

 

That may help explain things.