How to build the authorization header when sending HTTP calls to Bob.
When you send the HTTP requests to call Bob’s API, you need to include an authorization header which includes the following:
- Service user credentials: The API service user is how you can access Bob via the API. You must include in the header the service user’s ID and Token.
- The authentication method must be basic access authentication.
How to build the authorization header
First, follow the instructions in API Service Users to create a service user and assign the required permissions. Once you have the service user's credentials, you can build the authorization header:
- Form the credentials: Combine your service user ID and token into a single string, separated by a colon (:).
SERVICE-USER-ID:TOKEN
- Encode: Encode this combined string using Base64 encoding. The resulting string is your credentials in Base64 format.
Base64.encode(SERVICE-USER-ID:Qe8q89RwbzeS7mmhMcAsN1crM73m6MdbjewGCCUY)
Note: This sample is not specific to a single programming language.
It represents a conceptual example of encoding a string using Base64 encoding.
- Set the Authorization Header: Include an HTTP header field in your request in the form of:
authorization: Basic <Base64-encoded credentials>
Note: The method to perform Base64 encoding varies between programming languages. Consult the documentation for your specific language or ask your development team for details on how to encode the credentials.