Updated on 2024-12-02 GMT+08:00

Device Reporting File Upload Results

Function

This API is used by a device to report the file upload result.

Topic

Upstream: $oc/devices/{device_id}/sys/events/up

Parameters

Parameter

Mandatory/Optional

Type

Description

object_device_id

Optional

String

Explanation:

  • Mandatory when the child device reports data during the gateway device data reporting. Specify object_device_id as the child device ID of the device in the topic. Otherwise, the request fails.
  • When a directly connected device reports data, the value of object_device_id must be the same as that of device_id in the topic.
  • If this parameter is left blank, the value of this parameter is the same as that of device_id in the topic by default.

services

Optional

List<ServiceEvent>

Explanation:

List of services that an event is about.

ServiceEvent structure

Parameter

Mandatory/Optional

Type

Description

service_id

Mandatory

String

Explanation:

System field.

Value range:

Fixed at $file_manager.

event_type

Mandatory

String

Explanation:

System field.

Value range:

Fixed at upload_result_report.

event_time

Optional

String

Explanation:

Event time. UTC time format: yyyyMMdd'T'HHmmss'Z'.

If this parameter is not carried in the reported data or is in incorrect format, the time when the platform receives the data is used.

paras

Mandatory

Object

Explanation:

Event parameters in JSON format.

paras structure

Parameter

Mandatory/Optional

Type

Description

object_name

Mandatory

String

Explanation:

Name of the object uploaded to OBS.

result_code

Mandatory

Integer

Explanation:

Status of the file uploaded by the device.

Value range:

Result codes definition:

  • 0: successful upload
  • 1: upload failure

status_code

Optional

Integer

Explanation:

Status code returned by OBS after a file upload.

status_description

Optional

String

Explanation:

Status description returned by OBS after a file upload.

Example

Topic: $oc/devices/{device_id}/sys/events/up  
Data format:
{ 
    "object_device_id": "{object_device_id}", 
    "services": [{ 
        "service_id": "$file_manager", 
        "event_type": "upload_result_report", 
        "event_time": "20151212T121212Z",
         "paras": { 
            "object_name": "c6b39067b0325db34663d3ef421a42f6_12345678_a.jpg",
            "result_code": 0,
            "status_code": 200,
            "status_description": "upload success"
         } 
    }] 
}