Updated on 2024-06-27 GMT+08:00

Push a Batch Task Status Change Notification

Function

After the application calls the API for creating a rule triggering condition (resource is set to batchtask and event to update), the API for creating a rule action, and the API for modifying a rule triggering condition, and activates a rule, the platform pushes the result to the server specified by the rule when the batch task status changes.

URI

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

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

resource

Yes

String

Parameter description: subscribed resource name. Set this parameter to batchtask.

event

Yes

String

Parameter description: subscribed event. Set this parameter to update.

event_time

Yes

String

Parameter description: 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

Parameter description: UTC time when a resource event was generated. The value 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

Parameter description: 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

Parameter description: custom field list of the device.

Table 2 BatchTaskUpdateNotifyData

Parameter

Mandatory

Type

Description

body

Yes

BatchTaskUpdate object

Parameter description: message body.

Table 3 BatchTaskUpdate

Parameter

Mandatory

Type

Description

app_id

Yes

String

Parameter description: application ID.

task_id

Yes

String

Parameter description: batch task ID. The value is returned when the API for creating the batch task is called.

task_type

Yes

String

Parameter description: task type.

  • firmwareUpgrade: firmware upgrade

  • softwareUpgrade: software upgrade

status

Yes

String

Parameter description: 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

Parameter description: task status description.

Response Parameters

None

Example Requests

Example of a bulk task status change notification.

Batch Task Status Change Notification

{
  "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 Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.