Update Subscription Job


Update a subscription job.

Request Format


PUT https://{apigw-address}/subscription-service/v1/subscription

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

orgId

Query

Required

String

The OU ID where the subscription job belongs to. How to get orgId >>

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

subId

Required

String

The subscription job ID.

app

Required

String

The access key associated with the subscription job’s application, which cannot be updated.

desc

Optional

StringI18n

The description of the subscription job. Supports internationalization. Internationalized Field Representation >>

type

Required

Enum

Subscription type, which cannot be updated. Supports:

  • DATA: The subscription type is “Time Series Data Subscription”, and the message channel is “Real-Time”.

  • OFFLINE: The subscription type is “Time Series Data Subscription”, and the message channel is “Offline”.

  • EVENT: The subscription type is “Alert Data Subscription”, and the message channel is “Basic Alert Service”.

  • ALERT: The subscription type is “Alert Data Subscription”, and the message channel is “Advanced Alert Service”.

  • CASE: The subscription type is “Device Management Event Subscription”.

  • REPORT: The subscription type is “Device Event Report Subscription”.

content

Required

Content Struct

Subscription job details. Content Struct >>

Content Struct


Name

Required/Optional

Data Type

Description

customers

Required

List<String>

The OU IDs which need to subscribe to the job.

models

Optional

List<DeviceModel>

Model conditions for the job. DeviceModel Struct >>

useAllModels

Optional

Boolean

Whether to subscribe to all available models in the current OU, true means yes, false means no.

assetIds

Optional

List<String>

To specify organization structure filtering conditions, you can provide the site IDs you need to subscribe to on the organization structure. Only the “Time Series Data Subscription” type is supported.

structureRootId

Optional

String

Specify the organization structure ID. Only the “Time Series Data Subscription” type is supported.

tags

Optional

Map<String, String>

Specify device tag filtering conditions, structure is``{“key”:”value”}``. Only the following types are supported:

  • The subscription type is “Alert Data Subscription”, and the message channel is “Basic Alert”.

  • Subscription type is “Time Series Data Subscription”.

treeTags

Optional

Map<String, String>

Specify asset tree tag filtering conditions, structure such as``{“key”:”value”}``. Only the “Alert Data Subscription” type with the message channel “Basic Alert Service” is supported.

eventTypes

Optional

List<String>

Specify the filtering conditions of the device event type, structure such as``[“INFO”,”WARN”,”ERROR”]``. Only the “Device Event Report Subscription” type is supported.

sourceEventType

Optional

Map

Specify the device event type filtering conditions for subscription jobs, structure such as``{“MODEL”: [“CREATE”,”DELETE”,”UPDATE”]}``. Only the “Device Management Event Subscription” type is supported. The event types and their events are as follows:

  • MODEL: Represents the asset models, events include:

    • CREATE

    • DELETE

    • UPDATE

  • DEVICE_ASSET: Represents device assets, events include:

    • CREATE

    • ACTIVATE

    • ENABLE

    • DISABLE

    • DELETE

    • REPLACE_DEVICE_KEY

    • LOGIN

    • LOGOUT

    • CHANGE_INFO

    • ADD_SUBDEVICES

    • REMOVE_SUBDEVICES

    • REMOVE_ALL_SUBDEVICES

    • ADD_MIRROR_SOURCE

    • REMOVE_MIRROR_SOURCE

    • NOTIFY_COMMAND_STATE

  • LOGIC_ASSET: Represents logical assets, events include:

    • CREATE

    • DELETE

    • CHANGE_INFO

  • Foot_file: Represents the OTA firmware files, events include:

    • CREATED

    • DELETED

    • VERIFIED

  • Foot_job: Represents OTA jobs, events include:

    • CREATED

    • STARTED

    • STOPPED

    • UPDATED

    • STATISTICS_UPDATED

enabled

Optional

Boolean

Whether the subscription job has been started, true means it has been started, false means it has been suspended.

DeviceModel Struct


Name

Data Type

Description

models

String

Subscribed Model ID.

points

List<String>

Subscribed measurement point IDs, structure such as``[“point1”,”point2”]``.

useAllPoints

Boolean

Whether to subscribe to all measurement points under the model, true means yes, false means no.

public

Boolean

Whether the model is a public model, true means yes, false means no.

Samples

Request Sample


url: https://{apigw-address}/subscription-service/v1/subscription/?orgId=yourOrgId
method: PUT
requestBody:
{
  "id": 63,
  "subId": "yourSubId",
  "app": "yourAppAccessKey",
  "desc": {
       "default": "REPORT",
            "zh-CN": "设备事件上报",
            "en-US": "REPORT"
        },
        "orgId": "yourOrgId",
        "type": "REPORT",
        "content": {
            "customers": [
                "CustomerOrgId1"
            ],
            "models": [
                {
                    "modelId": "EnOS_Substation_Device",
                    "useAllPoints": false,
                    "points": [

                    ],
                    "public": null
                }
            ],
            "useAllModels": false,
            "assetIds": [

            ],
            "structureRootId": "",
            "tags": {

            },
            "treeTags": {

            },
            "eventTypes": [
                "WARN",
                "ERROR"
            ],
            "sourceEventType": {

            }
        },
        "enabled": false
}

Response Sample


{
    "retCode": 0,
    "data": null,
    "msg": null,
    "subMsg": null
}