Authenticating REST API requests

Each API request must be authenticated with a token - a unique user authentication identifier. You can retrieve the token by using REST API or from the License Metric Tool user interface. Depending on your License Metric Tool settings, you can provide the token in the URL string or in the request header.

Before you begin

By default, you can provide the token in the URL string or in the request header. The latter option is recommended for security reasons. To disable the possibility of providing the token in the URL string, go to Management > Advanced Server Settings, and change the value of the api_token_in_url_enabled parameter to false.

Procedure

  1. Retrieve the token.
    • To retrieve the token by using REST API, see: REST API for retrieving authentication token.
    • To retrieve the token from the user interface, log in to License Metric Tool, hover over the User icon User icon, and click Profile. Then, click Show token.
  2. Provide the token to authenticate the REST API request.
    • Provide the token in the request header. For example:
      Request
      GET https://hostname:port/api/sam/v2/software_instances
      Request header
      Accept: application/json 
      Accept-Language: en-US
      Token: <token>
    • Provide the token in the URL string. For example:
      Request
      GET https://hostname:port/api/sam/v2/software_instances?token=<token>
      Request header
      Accept: application/json 
      Accept-Language: en-US
    If you provide the token both in the URL string and the request header, token in the URL string is ignored.