file.put

The file.put command reserves a file handle to be used to upload a file through HTTP POST.

TR50 Request


                        {
  "cmd": {
    "command": "file.put",
    "params": {
      "fileName": "myname.txt",
      "thingKey": "myThing",
      "public": false,
      "tags": [
        "note",
        "readme"
      ]
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

thingKey

String

 

The Thing that the file will be attached to.

Note: Default to the current session's Thing. As a user, thingKey is required.

global

Boolean

 

If set to true, the file will be a global file and the thingKey parameter will be ignored. Defaults to false.

fileName

String

Yes

The name of the file to be retrieved from the platform.

public

Bool

 

If true, identifies the file as publicly accessible outside of the organization. If false, the file is private to the organization. Defaults to false.

crc32

Integer

 

A IEEE CRC32 checksum of the file to be uploaded. When the file is subsequently sent via the HTTP interface, the checksum will be validated, and if incorrect, the file will be discarded an an error returned.

tags

Array

 

A list of tags to associate to the file.

secTags

Array

 

A list of tags to specify security access to the file.

ttl

Integer

 

Specify an expect ttl (in seconds) for a file. If a file is uploaded partially and a ttl is set, partial file will be deleted after elapsed time.

logComplete

Boolean

 

If set to true, creates an event log entry when the file upload is complete.

TR50 Response

If the command is sent successfully a success message and params list is returned. Otherwise, an error and error message will be returned.


                        {
  "cmd": {
    "success": true,
    "params": {
      "fileId": "50000000000000000000042"
    }
  }
}
      

The fileId returned from file.put is only valid for a single use and times out within 300 seconds by default.

Response Parameters

Name

Type

Description

fileId

String

A unique file handle id to be used in the HTTP POST.