新增和编辑租户配置(待翻译)
接口地址:/api/tenantProfile
请求方式:POST
请求数据类型:application/x-www-form-urlencoded,application/json
响应数据类型:*/*
接口描述:
Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as time-based UUID. The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause ‘Not Found’ error.
Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants.
The ‘profileData’ object is the part of Tenant Profile that defines API limits and Rate limits.
You have an ability to define maximum number of devices (‘maxDevice’), assets (‘maxAssets’) and other entities. You may also define maximum number of messages to be processed per month (‘maxTransportMessages’, ‘maxREExecutions’, etc). The ‘*RateLimit’ defines the rate limits using simple syntax. For example, ‘1000:1,20000:60’ means up to 1000 events per second but no more than 20000 event per minute. Let’s review the example of tenant profile data below:
{
"name": "Default",
"description": "Default tenant profile",
"isolatedTbCore": false,
"isolatedTbRuleEngine": false,
"profileData": {
"configuration": {
"type": "DEFAULT",
"maxDevices": 0,
"maxAssets": 0,
"maxCustomers": 0,
"maxUsers": 0,
"maxDashboards": 0,
"maxRuleChains": 0,
"maxResourcesInBytes": 0,
"maxOtaPackagesInBytes": 0,
"transportTenantMsgRateLimit": "1000:1,20000:60",
"transportTenantTelemetryMsgRateLimit": "1000:1,20000:60",
"transportTenantTelemetryDataPointsRateLimit": "1000:1,20000:60",
"transportDeviceMsgRateLimit": "20:1,600:60",
"transportDeviceTelemetryMsgRateLimit": "20:1,600:60",
"transportDeviceTelemetryDataPointsRateLimit": "20:1,600:60",
"maxTransportMessages": 10000000,
"maxTransportDataPoints": 10000000,
"maxREExecutions": 4000000,
"maxJSExecutions": 5000000,
"maxDPStorageDays": 0,
"maxRuleNodeExecutionsPerMessage": 50,
"maxEmails": 0,
"maxSms": 0,
"maxCreatedAlarms": 1000,
"defaultStorageTtlDays": 0,
"alarmsTtlDays": 0,
"rpcTtlDays": 0,
"warnThreshold": 0
}
},
"default": true
}
Available for users with ‘SYS_ADMIN’ authority.
请求示例:
{
"default": true,
"description": "Any text",
"id": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9"
},
"isolatedTbCore": true,
"isolatedTbRuleEngine": true,
"name": "High Priority Tenants",
"profileData": {
"configuration": {}
}
}
请求参数:
参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 |
tenantProfileReq | TenantProfileReq | body | true | TenantProfileReq |
createdTime | Timestamp of the tenant profile creation, in milliseconds | false | integer(int64) | |
default | false | boolean | ||
description | Description of the tenant profile | false | string | |
id | JSON object with the tenant profile Id. Specify this field to update the tenant profile. Referencing non-existing tenant profile Id will cause error. Omit this field to create new tenant profile. | false | TenantProfileIdReq | |
id | ID of the entity, time-based UUID v1 | true | string | |
isolatedTbCore | If enabled, will push all messages related to this tenant and processed by core platform services into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | false | boolean | |
isolatedTbRuleEngine | If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | false | boolean | |
name | Name of the tenant profile | false | string | |
profileData | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | false | TenantProfileData | |
configuration | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | false | TenantProfileConfiguration |
响应参数:
参数名称 | 参数说明 | 类型 |
createdTime | Timestamp of the tenant profile creation, in milliseconds | integer(int64) |
default | boolean | |
description | Description of the tenant profile | string |
id | JSON object with the tenant profile Id. Specify this field to update the tenant profile. Referencing non-existing tenant profile Id will cause error. Omit this field to create new tenant profile. | TenantProfileIdRes |
entityType | string,可用值:TENANT_PROFILE | string |
id | ID of the entity, time-based UUID v1 | string(uuid) |
isolatedTbCore | If enabled, will push all messages related to this tenant and processed by core platform services into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
isolatedTbRuleEngine | If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
name | Name of the tenant profile | string |
profileData | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileData |
configuration | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileConfiguration |
响应示例:
{
"default": true,
"description": "Any text",
"id": {
"entityType": "TENANT_PROFILE",
"id": "784f394c-42b6-435a-983c-b7beff2784f9"
},
"isolatedTbCore": true,
"isolatedTbRuleEngine": true,
"name": "High Priority Tenants",
"profileData": {
"configuration": {}
}
}
删除租户配置(待翻译)
接口地址:/api/tenantProfile/{tenantProfileId}
请求方式:DELETE
请求数据类型:application/x-www-form-urlencoded
响应数据类型:*/*
接口描述:
Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error.
Available for users with ‘SYS_ADMIN’ authority.
请求参数:
参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 |
tenantProfileId | A string value representing the tenant profile id. For example, ‘784f394c-42b6-435a-983c-b7beff2784f9’ | path | true | string |
响应参数:
参数名称 | 参数说明 | 类型 |
errorCode | Platform error code:\n2 – General error (HTTP: 500 – Internal Server Error)\n\n10 – Authentication failed (HTTP: 401 – Unauthorized)\n\n11 – JWT token expired (HTTP: 401 – Unauthorized)\n\n15 – Credentials expired (HTTP: 401 – Unauthorized)\n\n20 – Permission denied (HTTP: 403 – Forbidden)\n\n30 – Invalid arguments (HTTP: 400 – Bad Request)\n\n31 – Bad request params (HTTP: 400 – Bad Request)\n\n32 – Item not found (HTTP: 404 – Not Found)\n\n33 – Too many requests (HTTP: 429 – Too Many Requests)\n\n34 – Too many updates (Too many updates over Websocket session)\n\n* 40 – Subscription violation (HTTP: 403 – Forbidden) | object |
message | Error message | string |
status | HTTP Response Status Code | integer(int32) |
timestamp | Timestamp | string(date-time) |
租户配置分页(待翻译)
接口地址:/api/tenantProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}
请求方式:GET
请求数据类型:application/x-www-form-urlencoded
响应数据类型:*/*
接口描述:
Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the ‘Model’ tab of the Response Class for more details.
Available for users with ‘SYS_ADMIN’ authority.
请求参数:
参数名称 | 参数说明 | 是否必须 | 数据类型 |
pageSize | Maximum amount of entities in a one page | true | integer(int32) |
page | Sequence number of page starting from 0 | true | integer(int32) |
textSearch | The case insensitive ‘substring’ filter based on the tenant profile name. | false | string |
sortProperty | Property of entity to sort by,可用值:createdTime,description,isDefault,name | false | string |
sortOrder | Sort order. ASC (ASCENDING) or DESC (DESCENDING),可用值:ASC,DESC | false | string |
响应参数:
参数名称 | 参数说明 | 类型 |
data | Array of the entities | array |
createdTime | Timestamp of the tenant profile creation, in milliseconds | integer(int64) |
default | boolean | |
description | Description of the tenant profile | string |
id | JSON object with the tenant profile Id. Specify this field to update the tenant profile. Referencing non-existing tenant profile Id will cause error. Omit this field to create new tenant profile. | TenantProfileIdRes |
entityType | string,可用值:TENANT_PROFILE | string |
id | ID of the entity, time-based UUID v1 | string |
isolatedTbCore | If enabled, will push all messages related to this tenant and processed by core platform services into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
isolatedTbRuleEngine | If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
name | Name of the tenant profile | string |
profileData | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileData |
configuration | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileConfiguration |
hasNext | ‘false’ value indicates the end of the result set | boolean |
totalElements | Total number of elements in all available pages | integer(int64) |
totalPages | Total number of available pages. Calculated based on the ‘pageSize’ request parameter and total number of entities that match search criteria | integer(int32) |
默认租户配置(待翻译)
接口地址:/api/tenantProfile/{tenantProfileId}/default
请求方式:POST
请求数据类型:application/x-www-form-urlencoded
响应数据类型:*/*
接口描述:
Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error.
Available for users with ‘SYS_ADMIN’ authority.
请求参数:
参数名称 | 参数说明 | 请求类型 | 是否必须 | 数据类型 |
tenantProfileId | A string value representing the tenant profile id. For example, ‘784f394c-42b6-435a-983c-b7beff2784f9’ | path | true | string |
响应参数:
参数名称 | 参数说明 | 类型 |
createdTime | Timestamp of the tenant profile creation, in milliseconds | integer(int64) |
default | boolean | |
description | Description of the tenant profile | string |
id | JSON object with the tenant profile Id. Specify this field to update the tenant profile. Referencing non-existing tenant profile Id will cause error. Omit this field to create new tenant profile. | TenantProfileIdRes |
entityType | string,可用值:TENANT_PROFILE | string |
id | ID of the entity, time-based UUID v1 | string(uuid) |
isolatedTbCore | If enabled, will push all messages related to this tenant and processed by core platform services into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
isolatedTbRuleEngine | If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants | boolean |
name | Name of the tenant profile | string |
profileData | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileData |
configuration | Complex JSON object that contains profile settings: max devices, max assets, rate limits, etc. | TenantProfileConfiguration |
响应示例:
{
"default": true,
"description": "Any text",
"id": {
"entityType": "TENANT_PROFILE",
"id": "784f394c-42b6-435a-983c-b7beff2784f9"
},
"isolatedTbCore": true,
"isolatedTbRuleEngine": true,
"name": "High Priority Tenants",
"profileData": {
"configuratio
n": {}
}
}