ThingsKit物联网平台API文档-租户管理(租户配置)

新增和编辑租户配置(待翻译)

接口地址:/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": {}
  }
}

请求参数:

参数名称参数说明请求类型是否必须数据类型
tenantProfileReqTenantProfileReqbodytrueTenantProfileReq
createdTimeTimestamp of the tenant profile creation, in millisecondsfalseinteger(int64)
defaultfalseboolean
descriptionDescription of the tenant profilefalsestring
idJSON 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.falseTenantProfileIdReq
idID of the entity, time-based UUID v1truestring
isolatedTbCoreIf 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 tenantsfalseboolean
isolatedTbRuleEngineIf 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 tenantsfalseboolean
nameName of the tenant profilefalsestring
profileDataComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.falseTenantProfileData
configurationComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.falseTenantProfileConfiguration

响应参数:

参数名称参数说明类型
createdTimeTimestamp of the tenant profile creation, in millisecondsinteger(int64)
defaultboolean
descriptionDescription of the tenant profilestring
idJSON 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
entityTypestring,可用值:TENANT_PROFILEstring
idID of the entity, time-based UUID v1string(uuid)
isolatedTbCoreIf 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 tenantsboolean
isolatedTbRuleEngineIf 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 tenantsboolean
nameName of the tenant profilestring
profileDataComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.TenantProfileData
configurationComplex 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.

请求参数:

参数名称参数说明请求类型是否必须数据类型
tenantProfileIdA string value representing the tenant profile id. For example, ‘784f394c-42b6-435a-983c-b7beff2784f9’pathtruestring

响应参数:

参数名称参数说明类型
errorCodePlatform 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
messageError messagestring
statusHTTP Response Status Codeinteger(int32)
timestampTimestampstring(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.

请求参数:

参数名称参数说明是否必须数据类型
pageSizeMaximum amount of entities in a one pagetrueinteger(int32)
pageSequence number of page starting from 0trueinteger(int32)
textSearchThe case insensitive ‘substring’ filter based on the tenant profile name.falsestring
sortPropertyProperty of entity to sort by,可用值:createdTime,description,isDefault,namefalsestring
sortOrderSort order. ASC (ASCENDING) or DESC (DESCENDING),可用值:ASC,DESCfalsestring

响应参数:

参数名称参数说明类型
dataArray of the entitiesarray
createdTimeTimestamp of the tenant profile creation, in millisecondsinteger(int64)
defaultboolean
descriptionDescription of the tenant profilestring
idJSON 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
entityTypestring,可用值:TENANT_PROFILEstring
idID of the entity, time-based UUID v1string
isolatedTbCoreIf 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 tenantsboolean
isolatedTbRuleEngineIf 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 tenantsboolean
nameName of the tenant profilestring
profileDataComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.TenantProfileData
configurationComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.TenantProfileConfiguration
hasNext‘false’ value indicates the end of the result setboolean
totalElementsTotal number of elements in all available pagesinteger(int64)
totalPagesTotal number of available pages. Calculated based on the ‘pageSize’ request parameter and total number of entities that match search criteriainteger(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.

请求参数:

参数名称参数说明请求类型是否必须数据类型
tenantProfileIdA string value representing the tenant profile id. For example, ‘784f394c-42b6-435a-983c-b7beff2784f9’pathtruestring

响应参数:

参数名称参数说明类型
createdTimeTimestamp of the tenant profile creation, in millisecondsinteger(int64)
defaultboolean
descriptionDescription of the tenant profilestring
idJSON 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
entityTypestring,可用值:TENANT_PROFILEstring
idID of the entity, time-based UUID v1string(uuid)
isolatedTbCoreIf 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 tenantsboolean
isolatedTbRuleEngineIf 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 tenantsboolean
nameName of the tenant profilestring
profileDataComplex JSON object that contains profile settings: max devices, max assets, rate limits, etc.TenantProfileData
configurationComplex 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": {}
	}
}