Updated on 2023-11-08 GMT+08:00

Push a Batch Task Status Change Notification

Function

This API is used by the platform to push a notification for batch task status changes to an application after the application calls the APIs for Creating A Rule Triggering Condition (resource is set to batchtask and event to update), Creating A Rule Action, and Modifying a Rule Triggering Condition to configure and activate a rule.

Precautions

The application must send a response code after receiving a message pushed by the platform.

URI

Request Method

POST

URI

HTTP URL determined when the application creates a batch task status change notification rule. The AMQP channel does not require the URL.

Transport Protocol

HTTPS

Request Parameters

Parameter

Mandatory

Type

Location

Description

resource

Yes

String

Body

Subscribed resource name. Set this parameter to batchtask.

event

Yes

String

Body

Subscribed event. Set this parameter to update.

event_time

Yes

String

Body

UTC time when the resource event was generated. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. If necessary, convert the time to display in the local time zone format.

event_time_ms

No

String

Body

Time when a resource event is generated. The value is a UTC character string in the format of yyyy-MM-dd'T'HH:mm:ss.SSS'Z', for example, 2015-12-12T12:12:12.000Z. If necessary, convert the time to display in the local time zone format.

request_id

No

String

Body

Message ID which is specified by the device or generated by the platform and is used to trace the service process.

notify_data

Yes

BatchTaskUpdateNotifyData Object

Body

Custom field list of the device.

Table 1 BatchTaskUpdateNotifyData

Parameter

Mandatory

Type

Description

body

Yes

BatchTaskUpdate Object

Message body.

Table 2 BatchTaskUpdate

Parameter

Mandatory

Type

Description

app_id

Yes

String

Application ID.

task_id

Yes

String

Batch task ID. The value is returned when the API for creating the batch task is called.

task_type

Yes

String

Task type.

  • firmwareUpgrade: firmware upgrade.
  • softwareUpgrade: software upgrade.

status

Yes

String

Task status.

  • Waitting: The batch task is waiting to be executed.
  • Processing: The batch task is being executed.
  • Success: The batch task is executed.
  • PartialSuccess: Only some subtasks in the batch task are executed.
  • Fail: The batch task fails to be executed.
  • Stopped: The batch task is stopped.

status_desc

Yes

String

Task status description.

Example Request

POST https://{Endpoint} HTTP URL determined when the application creates a batch task status change notification rule. The AMQP channel does not require the URL.
Content-Type: application/json

{
  "resource" : "batchtask",
  "event" : "update",
  "event_time" : "20151212T121212Z",
  "event_time_ms" : "2015-12-12T12:12:12.000Z",
  "request_id" : "3fe58d5e-8697-4849-a165-7db128f7e776",
  "notify_data" : {
    "body" : {
      "status_desc" : "status_desc",
      "task_id" : "1a7ffc5c-d89c-44dd-8265",
      "task_type" : "softwareUpgrade",
      "app_id" : "1a7ffc5c-d89c-44dd-8265-b1653d951ce0",
      "status" : "Waitting"
    }
  }
}

Example Response

Status Code: 200 OK