Sending Files

This tutorial

Sending two Files to Multiple Devices

A user requests to send two Files to multiple devices, and receives an Operation object as a response:

Request

POST {url}/v5.0/device/file/send
{
  "deviceIds": [
      "d60794d111aa919de914f9311",
      "d60794d111aa919de914f9312"
  ],
  "fileIds": {
      "f6079517a1aa919de914f93f1": {"version": 1},
      "f6079517a1aa919de914f93f2": {"version": 2},
  }
}

Response

{
  "head": {
    "status": 200,
    "ok": true,
    "messages": [],
    "errors": [],
    "references": {}
  },
  "body": {
    "id": "o607db15b2128a8f9a1b744e9",
    "action": "SEND_FILE",
    ...

Retrieving the StepList

The user now queries the Step API to retrieve the StepList objects for this Operation:

Request

GET {url}/v5.0/step/o607db15b2128a8f9a1b744e9

Response

{
  "head": {
      ...
  },
  "body": [
    // 2 StepLists, 1 for each Device
    {
      "id": "u607ef0a29d3840b6b0a23d9f",
      "action": "SEND_FILE",
      ...
      "state": "STARTED",
      "steps": [

        // Each result has 2 Steps, one for each File
        {
          "action": "SEND_FILE",
          "state": "STARTED",
          "complete": false,
          "percentComplete": 30,
          "details": {
            ...
          }
        }
        {
          "action": "SEND_FILE",
          "state": "REQUESTED",
          "complete": false,
          "percentComplete": 0,
          "details": {
            ...
          }
        }
      ],
      // The ID of the Device
      "targetId": "d60794d111aa919de914f9311"
     },

     // The second result
     {
        ...

👍

Tip

Tracking Operations at the StepList and Step level allow for more detailed tracking of an overall Operation.