Usage example of API function

This example shows how to acquire Agent details from the list of instances of Agent after a login.

1. Call the Acquire an API key API function.

2. Call the Acquire a list of Agent instances API function.

3. Using the acquired Agent ID, call the Acquire Agent instance details API function.

(1) Acquire an API key (/api/v1/login)

1. Give the API function a user name and password by using a JSON format.

2. An API key is returned by using a JSON format after an execution of a login to Manager.

Curl command execution example (In Linux)
curl -X POST --header 'Content-Type: application/json'
             --header 'Accept: application/json'
             -d '{  "password": "admin",  "userName": "admin"}'
             'http://localhost:8765/api/v1/login'
Curl command execution example (In Windows)
curl.exe -X POST --header "Content-Type: application/json"
                 --header "Accept: application/json"
                 -d "{\"password\": \"admin\", \"userName\": \"admin\"}"
                 "http://localhost:8765/api/v1/login"
Returned JSON data example
{
  "userId":"12abc3d4-5a67-89ab-ab1a-1234a5b6cd78",
  "expiresOn":1506612812802,
  "apiKey":"ab123456-abc1-1a2b-1a23-1a2345b6789c",
  "clientSecret":"ab654321-abc1-1a2b-1a23-1a2345b6789c"
}

(2) Acquire a list of Agent instances (/api/v1/agents)

1. Set the API key to the request header.

2. Give the API function an index and a size of the page by using a query format.

3. The list of Agent instances is returned by using a JSON format.

Curl command execution example (In Linux)
curl -X GET --header 'Accept: application/json'
            --header 'X-API-KEY:ab123456-abc1-1a2b-1a23-1a2345b6789c'
            'http://localhost:8765/api/v1/agents?sort=+name&page=0&size=100'
Curl command execution example (In Windows)
curl.exe -X GET --header "Accept: application/json"
                --header "X-API-KEY:ab123456-abc1-1a2b-1a23-1a2345b6789c"
                "http://localhost:8765/api/v1/agents?sort=+name&page=0&size=10"
Returned JSON data example
{
  "content": [
  {
    "activationKey": "ab123456-abc1-1a2b-1a23-1a2345b6789c",
    "afterModuleUpdated": false,
    "agentId": "1a2b3456-7890-1a23-a123-1abc2a345b6c",
    "agentVersion": 11,
    (hereafter omitted)					

(3) Acquire Agent instance details (/api/v1/agents/agentId)

1. Set the API key to the request header.

2. Give the API function an Agent ID by using a path format.

3. The Agent instance details are returned by using a JSON format.

Curl command execution example (in Linux)
curl -X GET --header 'Accept: application/json'
            --header 'X-API-KEY:ab123456-abc1-1a2b-1a23-1a2345b6789c'
            'http://localhost:8765/api/v1/agents/1a2b3456-7890-1a23-a123-1abc2a345b6c'
Curl command execution example (in Windows)
curl.exe -X GET --header "Accept: application/json"
                --header "X-API-KEY:ab123456-abc1-1a2b-1a23-1a2345b6789c"
                "http://localhost:8765/api/v1/agents/1a2b3456-7890-1a23-a123-1abc2a345b6c"
Returned JSON data example
{
  "activationKey": "ab123456-abc1-1a2b-1a23-1a2345b6789c",
  "afterModuleUpdated": false,
  "agentId": "1a2b3456-7890-1a23-a123-1abc2a345b6c",
  "agentVersion": 11,
  "agentVersionSyncronized": false,
  "basicSettings": {
  "autoResendingRetryCount": 60,
  "autoResendingRetryInterval": 60,
  "connectionRetryCount": 8640,
  (hereafter omitted)