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": "dk",
  "msgTypes": [
    1
  ],
  "productKey": "pk",
  "queueName": "queueName",
  "subscribeName": "test"
}

Request Parameters:

Parameter NameParameter DescriptionRequest TypeRequiredData TypeSchema
subscribeDTOSubscription informationbodytrueOpenApiSubscribeDTOOpenApiSubscribeDTO
  dataLevelData level, 1-Product 2-Devicetrueinteger(int32)
  deviceKeyDevice DKfalsestring
  msgTypesMessage types:\nTransparent transmission products support the following types:\n1-Device online/offline events\n2-Device and module status\n3-Device uplink data\n4-Device downlink data\n5-Device command response\n12-Device location original information\n13-Device location information\n14-Device binding change information\n15-Device information change\nThing model products support the following types:\n1-Device online/offline events\n2-Device and module status\n3-Device uplink transparent transmission data\n4-Device downlink transparent transmission data\n5-Device command response\n6-Thing model property information\n7-Thing model event report-information\n8-Thing model event report-alert\n9-Thing model event report-fault\n10-Thing model service call log\n12-Device location original information\n13-Device location information\n14-Device binding change information\n15-Device information changetruearrayinteger
  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": 0,
	"data": {
		"subscribeId": 1
	},
	"msg": "",
	"pageNum": 0,
	"pageSize": 0,
	"pages": 0,
	"total": 0
}