License Usage API
Use the License Usage API to get usage information about license that is installed on the system.
These endpoints can be invoked only by a site admin.
import json, requests
api_root = "<URL_BASE>/api/v1/license-service/usage"
Get Usage information for all the Licenses
Use this API to get license usage for all licenses/products.
Request
Supported query parameters are:
group_by
: (required) List of properties that needs to be populated in response. IBLicenseID is a required item that should be present in the list. Supported values in list are: UserAccountID, IBLicenseID, ProductName, ProductVersion, ResourceName, ProductResourceID, AssignmentID, CreditIDproduct_name
: (Optional) If specified, will return only the usage corresponding to the product.resource_name
: (Optional) If specified, will return only the usage corresponding to the resource.user_account_id
: (Optional) If specified, will return only the usage by user having acoount_id=user_account_id.job_id
: (Optional) If specified, will return only the usage corresponding to the job with id=job_id.
headers = {'Authorization': 'Bearer {0}'.format(token)}
resp = requests.get(api_root +
'?group_by=IBLicenseID,ProductResourceID,ProductName,ResourceName,CreditID&product_name=FLOW',
headers=headers).json()
Response
Returns a list of usage metrics
{
"usage_metrics": [
{
"ib_license_id": "fc55db3ce55f4c1ba1dfbebcb86d99ba",
"product_name": "FLOW",
"resource_name": "DIGITIZED_PAGES",
"product_resource_id": "6fba7d4bc4a049d49f236b2ad12dcd4d",
"credit_id": "9feae6d8b7ba4ee791e47d9018b3641f",
"usage_amount": "10",
"credit_cost": "10000000000",
"user_account_id": "",
"product_version": "ANY",
"assignment_id": "",
"timestamp_in_secs": "0",
"job_id": "",
"tags": ""
}
]
}
Get Usage information for a single License
Use this API to get the license usage for an individual license.
Request
Supported query parameters are:
group_by
: (required) List of properties that needs to be populated in response. IBLicenseID is a required item that should be present in the list. Supported values in list are: UserAccountID, IBLicenseID, ProductName, ProductVersion, ResourceName, ProductResourceID, AssignmentID, CreditIDproduct_name
: (Optional) If specified, will return only the usage corresponding to the product.resource_name
: (Optional) If specified, will return only the usage corresponding to the resource.user_account_id
: (Optional) If specified, will return only the usage by user having acoount_id=user_account_id.job_id
: (Optional) If specified, will return only the usage corresponding to the job with id=job_id.
headers = {'Authorization': 'Bearer {0}'.format(token)}
resp = requests.get(api_root + '/<license_ID>'+
'?group_by=IBLicenseID,ProductResourceID,ProductName,ResourceName,CreditID',
headers=headers).json()
Response
Returns a list of usage metrics
{
"usage_metrics": [
{
"ib_license_id": "d0db40195b604763b9a7520b511a8d48",
"product_name": "FLOW",
"resource_name": "DOCUMENT_EXTRACTION",
"product_resource_id": "b097f3bcd3fb4716a9e989c211d5a0af",
"credit_id": "482e04c8482e473ea1da8b8254df0cca",
"usage_amount": "12",
"credit_cost": "12000000000",
"user_account_id": "",
"product_version": "ANY",
"assignment_id": "",
"timestamp_in_secs": "0",
"job_id": "",
"tags": ""
},
{
"ib_license_id": "d0db40195b604763b9a7520b511a8d48",
"product_name": "FLOW",
"resource_name": "CLASSIFIED_PAGES",
"product_resource_id": "4410ef149bf447c69eabf113dbbf94fb",
"credit_id": "482e04c8482e473ea1da8b8254df0cca",
"usage_amount": "6",
"credit_cost": "6000000000",
"user_account_id": "",
"product_version": "ANY",
"assignment_id": "",
"timestamp_in_secs": "0",
"job_id": "",
"tags": ""
},
{
"ib_license_id": "d0db40195b604763b9a7520b511a8d48",
"product_name": "FLOW",
"resource_name": "DIGITIZED_PAGES",
"product_resource_id": "46b55677690349528c4e9b72418bc2d8",
"credit_id": "482e04c8482e473ea1da8b8254df0cca",
"usage_amount": "12",
"credit_cost": "12000000000",
"user_account_id": "",
"product_version": "ANY",
"assignment_id": "",
"timestamp_in_secs": "0",
"job_id": "",
"tags": ""
}
]
}