> ## Documentation Index
> Fetch the complete documentation index at: https://learn.servitly.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get user to thing authorizations
> Retrieves the thing authorizations for a specific user, i.e. the grants that allow a user to operate on the things of a customer.
Each authorization reports the authorization level, the user-type impersonated by the user when operating on the thing and the optional time limitation of the grant.
When userId is specified, the customerId must be specified as well; set includeDefaults to true to obtain also the default authorizations applied to the users of the customer.
Required permissions: READ_USER_AUTHORIZATION.
## OpenAPI
````json GET /inventory/userThingAuthorizations
{
"openapi": "3.1.0",
"info": {
"title": "Servitly DPS API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.servitly-sandbox.com",
"description": "[AWS SANDBOX]"
},
{
"url": "https://api.servitly.com",
"description": "[AWS PRODUCTION Ireland]"
},
{
"url": "https://api-ap.servitly.com",
"description": "[AWS Hong Kong]"
},
{
"url": "https://azapi.servitly-dev.com",
"description": "[AZURE DEV Frankfurt]"
},
{
"url": "https://azapi.servitly-staging.com",
"description": "[AZURE STAGING Frankfurt]"
},
{
"url": "https://azapi.servitly.com",
"description": "[AZURE PRODUCTION Frankfurt]"
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "ACTIONS"
},
{
"name": "ALERTS"
},
{
"name": "API GATEWAY"
},
{
"name": "AUTHENTICATION"
},
{
"name": "AUTHORIZATIONS"
},
{
"name": "CUSTOMERS"
},
{
"name": "DATA IMPORT / EXPORT"
},
{
"name": "EVENTS"
},
{
"name": "LOCATIONS"
},
{
"name": "MAINTENANCE"
},
{
"name": "MAPPING"
},
{
"name": "METRIC DATA"
},
{
"name": "MOBILE APP"
},
{
"name": "ORGANIZATION"
},
{
"name": "PARTNERS"
},
{
"name": "PRODUCT MODELS"
},
{
"name": "SPARE PARTS"
},
{
"name": "STATISTICS"
},
{
"name": "STORE ORDERS"
},
{
"name": "SUBSCRIPTIONS"
},
{
"name": "SUBSCRIPTIONS (OLD)"
},
{
"name": "THING CONTROL"
},
{
"name": "THING DEFINITIONS"
},
{
"name": "THING MANAGEMENT"
},
{
"name": "THINGS"
},
{
"name": "TICKETS"
},
{
"name": "USER TYPES"
},
{
"name": "USERS"
},
{
"name": "WORK SESSIONS"
}
],
"paths": {
"/inventory/userThingAuthorizations": {
"get": {
"summary": "Get user to thing authorizations",
"description": "Retrieves the thing authorizations for a specific user, i.e. the grants that allow a user to operate on the things of a customer.
Each authorization reports the authorization level, the user-type impersonated by the user when operating on the thing and the optional time limitation of the grant.
When userId is specified, the customerId must be specified as well; set includeDefaults to true to obtain also the default authorizations applied to the users of the customer.
Required permissions: READ_USER_AUTHORIZATION.",
"tags": [
"AUTHORIZATIONS"
],
"parameters": [
{
"$ref": "#/components/parameters/tenantNameHeader"
},
{
"$ref": "#/components/parameters/customerId"
},
{
"in": "query",
"name": "userId",
"required": "false",
"schema": {
"$ref": "#/components/schemas/ObjectId"
},
"description": "The identifier of the user whose permissions must be retrieved.
If specified, the customerId must also be specified."
},
{
"in": "query",
"name": "includeDefaults",
"required": "true",
"schema": {
"type": "boolean",
"minimum": "1"
},
"description": "The flag defining whether to retrieve also the default user authorizations."
}
],
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserThingAuthorization"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/NotAuthenticated"
},
"403": {
"$ref": "#/components/responses/NotAuthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/ApiLimit"
},
"500": {
"$ref": "#/components/responses/IntError"
}
}
}
}
},
"components": {
"parameters": {
"tenantNameHeader": {
"in": "header",
"name": "X-Servitly-Tenant",
"required": "true",
"schema": {
"type": "string",
"example": "{{tenantName}}"
},
"description": "The name of the tenant (e.g. acme)."
},
"customerId": {
"in": "query",
"name": "customerId",
"required": "false",
"schema": {
"type": "string",
"example": "abcd1234"
},
"description": "Condition on customer id."
}
},
"schemas": {
"ObjectId": {
"type": "string",
"example": "abcd1234",
"minimum": "1",
"description": "The object identifier (e.g. 6620e4bb42541977c406b984)."
},
"UserThingAuthorization": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The authorization unique identifier.",
"readOnly": "true"
},
"userId": {
"type": "string",
"description": "The identifier of the user associated with this authorization."
},
"thingId": {
"type": "string",
"description": "The identifier of the thing associated with this authorization."
},
"authorization": {
"type": "string",
"enum": [
"GRANT",
"DENY"
],
"description": "The authorization of the user on the thing."
},
"userTypeId": {
"type": "string",
"description": "The identifier of the user-type the user impersonates when operating on the associated thing."
},
"userType": {
"readOnly": "true",
"description": "The user-type object associated with this authorization.",
"allOf": [
{
"$ref": "#/components/schemas/UserType"
}
]
},
"limitedTime": {
"type": "object",
"description": "The time limitation of this authorization.",
"allOf": [
{
"$ref": "#/components/schemas/LimitedTime"
}
]
}
}
},
"UserType": {
"type": "object",
"properties": {
"id": {
"type": "string",
"readOnly": "true",
"description": "The user-type object identifier."
},
"name": {
"type": "string"
},
"category": {
"type": "string",
"description": "The category this user type belongs to, one of ORGANIZATION, CUSTOMER, PARTNER."
},
"rank": {
"type": "integer",
"description": "The rank of the user type used to prevent unauthorized user reads or updates."
},
"commandPayloadDuration": {
"type": "integer",
"description": "The duration in milliseconds a command-payload is valid after its creation."
},
"permissions": {
"description": "The list of permissions associated with this user type.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"LimitedTime": {
"type": "object",
"properties": {
"startDayTime": {
"type": "number",
"description": "The day time the authorization starts (e.g. 10:00 -> 1000). The default value is 0.",
"example": "1000"
},
"endDayTime": {
"type": "number",
"description": "The day time the authorization ends (e.g. 20:30 -> 2230). The default value is 2359.",
"example": "2230"
},
"weekDays": {
"description": "The list of week days the authorization is valid.",
"type": "array",
"items": {
"type": "string",
"enum": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
]
}
},
"startTimestamp": {
"type": "integer",
"format": "int64",
"description": "The timestamp UTC the authorization starts.",
"example": "1578438000000"
},
"endTimestamp": {
"type": "integer",
"format": "int64",
"description": "The timestamp UTC the authorization ends.",
"example": "1578438000000"
}
}
}
},
"responses": {
"NotAuthenticated": {
"description": "User not authenticated.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authenticated"
}
}
}
}
}
},
"NotAuthorized": {
"description": "User not authorized.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authorized"
}
}
}
}
}
},
"NotFound": {
"description": "Resource was not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Resource not found"
}
}
}
}
}
},
"ApiLimit": {
"description": "API call rate limit exceeded.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "API call rate limit exceeded"
}
}
}
}
}
},
"IntError": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Internal Server Error"
}
}
}
}
}
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
}
}
}
}
````