I’m trying to retrieve license consumption statistics using the following endpoint:
GET /api/Stats/GetConsumptionLicenseStats
However, this endpoint requires the Tenant ID (either the logical name or ID), which I’m attempting to obtain via:
GET /odata/Tenants
The issue is that whenever I call this endpoint, I receive the following error:
{
"message": "You are not authorized!",
"errorCode": 0,
"result": null,
"targetUrl": null,
"success": false,
"error": {
"code": 0,
"message": "You are not authorized!",
"details": "You are not allowed to perform this operation.",
"validationErrors": null
},
"unAuthorizedRequest": true,
"__abp": true
}
I’m using an access token obtained through the Client Credentials flow with the OR.Administration scope already included, and I can successfully authenticate and access other endpoints. The problem seems specific to /odata/Tenants.
My questions:
Does anyone know how to grant the correct permissions for this type of access via API?
Do I need to enable something specific for the external application or the associated identity?
How can I get the Tenant ID without using the API?
Is there any other way to retrieve license consumption statistics via API?
Any help would be greatly appreciated — thanks in advance!
I was able to identify the tenant key and the tid from the URL as you explained.
However, when I try to use the tenant ID in the endpoint:
GET /api/Stats/GetConsumptionLicenseStats
I still receive a “You are not authorized” error.
I’m using a token obtained via Client Credentials flow with the OR.Administration scope. Other endpoints work fine, but this one seems to require something more.
Do I need to assign specific permissions or roles to the machine identity or the external application to access license statistics?
{
“message”: “You are not authorized!”,
“errorCode”: 0,
“result”: null,
“targetUrl”: null,
“success”: false,
“error”: {
“code”: 0,
“message”: “You are not authorized!”,
“details”: “You are not allowed to perform this operation.”,
“validationErrors”: null
},
“unAuthorizedRequest”: true,
“__abp”: true
}