Updated on 2023-02-16 GMT+08:00

Device Requesting a URL for File Download

Function

This API is used by a device to report a request for obtaining a URL for file download.

Topic

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

Parameters

Parameter

Mandatory or Optional

Type

Description

object_device_id

Optional

String

Indicates the device that the event is about. If this parameter is not carried, the device specified in the topic is considered to be the device involved.

services

Optional

List<ServiceEvent>

Indicates a list of services that the event is about.

ServiceEvent structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

System field. The value is fixed to $file_manager.

event_type

Mandatory

String

System field. The value is fixed to get_download_url.

event_time

Optional

String

Indicates the time when the event occurs.

paras

Mandatory

Object

Indicates the event parameters in JSON format.

paras structure

Parameter

Mandatory or Optional

Type

Description

fileName

Mandatory

String

Indicates the name of the file to download.

file_attributes

Optional

Object

Indicates the file attributes in JSON format.

Example

Topic: $oc/devices/{device_id}/sys/events/up  
Data format:
{ 
    "object_device_id": "{object_device_id}", 
    "services": [{ 
        "service_id": "$file_manager", 
        "event_type": "get_download_url", 
        "event_time": "20151212T121212Z",
         "paras": { 
            "file_name": "a.jpg",
            "file_attributes": {
                "hash_code": "58059181f378062f9b446e884362a526",
                "size": 1024
            }
         } 
    }] 
}