Real-Time License Usage Management via Licensing API

Real-Time License Usage Management via Licensing API

Introduction

This document provides an overview of how to utilize the Licensing API to monitor and manage license usage effectively. By leveraging this API, administrators can retrieve real-time data on the number of active users and enforce user limits for optimal license allocation. 

In order to access the license usage data, two steps need to be performed:
  1. Obtain the authentication token
  2. Retrieve license data.

Here is how to do that.

1. Obtaining the authentication token

To gain access, you must first acquire an authentication token by sending a POST request to the auth/login endpoint. The request should contain the following parameters.

Element
Description
Endpoint
POST <protocol>://<host>:<port>/__base__/auth/login
<protocol>
Specify either http or https.
<host>:<port>
The URL of the gateway implementation.
Query Parameters
None

Example Request: POST http://162.254.24.208:9443/__base__/auth/login

Request Body (JSON)
{
"clientID": "4F5F926E-42D9-4F78-9C14-FFD0747A8036",
"clientSecret": "kklri2mqy7ulrt4y57zdlxd8d1ab4nl9",
"context": "API Access"
}

The clientID can be configured or obtained from the Thinfinity Configuration Manager. To do that, first, navigate to the Authentication>Methods tab and click Add to set API access as an authentication method. Next, double-click on the API Access method to access the Authentication Method Settings dialog window. Alternatively, select the API Access method from the list and click Edit.




In the Authentication Method Settings dialog window click Add to bring up the API User dialog window.



 From the API User dialog window copy the ClientID and the ClientSecret for the next step.





Response Example

Upon a successful POST request, you will receive a response similar to the following:

{
      "data": {
      "gwsid": "",
      "token""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expirationSecs": 120
      }
}
  • token: Use this for subsequent API requests.
  • expirationSecs: The duration (in seconds) for which the token is valid, as configured in API User dialog window (Token validity field).


  • 2. Retrieving License Usage Data

    Once you have the authentication token, you can query the license usage information.

    Element
    Description
    Endpoint
    GET <protocol><host>:<port>/__base__/licenses/usage
    Authorization Header
    Authorization: Bearer <token>

    Example request: GET http://162.254.24.208:9443/__base__/licenses/usage

    Response Example

    {
      "data": {
        "res": "0",
        "licenses": [
          {    
            "product": "Thinfinity Workspace v7.0",
            "serial": "ZAWM-QIIA-ONGR-5524-BJWQ-WSEQ-SZGF-EOY7",
            "usage": {
              "users": 0,
              "seats": 1
            }
          }
        ]
      }
    }
  • users: The number of active licenses (concurrent users).
  • seats: The total number of available licenses.

  • Attachments

    Refer to the Postman API collection provided for testing these requests.



      • Related Articles

      • Installation & License Registration

        Introduction This guide is designed to walk you through your first Thinfinity® Workspace installation. We will focus on the most streamlined installation process, which involves deploying all components on a single server. Although this simplified ...
      • Enable Real Time Audio and Video

        Introduction This document will walk you through the steps of using Thinfinity® Workspace to forward video and audio over Remote Desktop Protocol (RDP) connections. Enabling video and audio transmission over RDP connections is critical for delivering ...
      • Instance Management Panel

        Intro Imagine a scenario where an IT administrator needs to oversee and manage a fleet of virtual machines (VMs) deployed across various departments in a company. The Instance Management Panel in Thinfinity Workspace becomes an indispensable tool in ...
      • Setting up Resource Reservation

        Resource Reservation Permissions Overview In the Resource Reservation system, managing access and actions is streamlined through a well-defined permissions structure. This structure is crucial for maintaining efficient and orderly operations. Each ...
      • One-Time URL in Thinfinity

        Thinfinity Workspace includes a very powerful feature that allows you to create 1-time disposable links. These links can be used to perform all kinds of integrations. The following are just some examples of what you can accomplish using OT URL: – ...