Skip to content

Create Product/Device Subscription

API Address:/v2/quecrule/{version}/openapi/subscribe/create

Request Method:POST

Request Data Type:application/json

Response Data Type:*/*

API Description:Create subscription

Request Example:

javascript
{
  "dataLevel": 1,
  "deviceKey": "DK00001",
  "msgTypes": [
    1
  ],
  "productKey": "PK0001",
  "queueName": "queueName",
  "subscribeName": "test"
}

Request Parameters:

Parameter NameParameter DescriptionRequest TypeRequiredData TypeSchema
dataLevelData level, 1-Product 2-Devicetrueinteger(int32)
deviceKeyDevice DKfalsestring
msgTypesMessage types:
Transparent transmission products support the following types:
1-Device online/offline events
2-Device and module status
3-Device uplink data
4-Device downlink data
5-Device command response
12-Device location original information
13-Device location information
14-Device binding change information
15-Device information change
Thing model products support the following types:
1-Device online/offline events
2-Device and module status
3-Device uplink transparent transmission data
4-Device downlink transparent transmission data
5-Device command response
6-Thing model property information
7-Thing model event report-information
8-Thing model event report-alert
9-Thing model event report-fault
10-Thing model service call log
12-Device location original information
13-Device location information
14-Device binding change information
15-Device information change
truearrayinteger
productKeyProduct PKtruestring
queueNameQueue nametruestring
subscribeNameSubscription name, maximum length 128 characters, supports Chinese, uppercase and lowercase English characters (case-sensitive), numbers, underscores (_), hyphens (-), does not support slashes (/), spaces, or other characterstruestring
versionCurrent version, valid value:r1pathtruestring

Response Status:

Status CodeDescriptionSchema
200OKActionResultOfOpenApiSubscribeIdDTO
201Created
401Unauthorized
403Forbidden
404Not Found
16002The queue name does not exist
16018The number of subscription rules is out of limit
16024The message subscription is not enabled, please go to the SaaS development Guide to apply for enabling
50000Service exception
50004Parameter null or empty
50005Parameter check error
70017The product does not exist
70060Permission Denied
70130The device does not exist
91004Token incorrect
91005Doesn't have permission

Response Parameters:

Parameter NameParameter DescriptionTypeSchema
codeReturn codeinteger(int32)integer(int32)
dataObjectOpenApiSubscribeIdDTOOpenApiSubscribeIdDTO
  subscribeIdSubscription IDinteger(int64)
msgPrompt messagestring
pageNumCurrent page numberinteger(int32)integer(int32)
pageSizeItems per pageinteger(int32)integer(int32)
pagesTotal pagesinteger(int32)integer(int32)
totalTotal countinteger(int32)integer(int32)

Response Example:

javascript
{
	"code": 200,
	"data": {
		"subscribeId": 1
	},
	"msg": ""
}