Using API Key in SystemLink HTTP API

Updated Nov 7, 2022

Environment

Software

  • SystemLink
  • SystemLink Server

SystemLink HTTP API can be executed with API key instead of Basic Authentication. It is often used to prevent excess communication with authentication server. Here you will learn how to create an API Key and how to use it.

API Key creation in SystemLink can be done by the following two HTTP APIs.

  1. Create Policy (POST /niauth/v1/policies)
  2. Create API key (POST /niauth/v1/keys)
  3. Example of using API keys

 

  1. Create Policy (POST /niauth/v1/policies)

    Policy is necessary to define action, resource and workspace for a user of specific name. In the following user1 is created with the policy ID of 0d92be8b-4772-4965-8f57-9e1644a03bf2.

    POST_policies2.png

    You can create multiple API keys for a policy ID. When you will apply the same policy for multiple clients you can allow multiple clients to use a single API key. When you will allocate different actions, resources or workspace for each client, you have to create each policy for them.

     
  2. Create API key (POST /niauth/v1/keys)

    To create API key, you need policy ID you've got in the previous section. Here, API key is given as secret = aOFkYvM8eaypigGpMUmxbHRn-NhjkPTOTmahQbWHYS for name = user1 and policy ID0d92be8b-4772-4965-8f57-9e1644a03bf2.

    POST_keys2.png

     

  3. Example of using API keys

    By adding API key as a x-ni-api-key header you can send your HTTP request without basic authentication. Here, there is an example to get all API key name and ID. (You cannot see the value of secret. API key itself is hidden.)

    checkapikeyresults.png

    CheckAPIkey.png

    To the top