Read a File
This file service is used to read the content of a file.
If the file was scanned seven days ago or not scanned earlier, the system triggers the scanning. As a result, if the file contains malware or does not belong to the supported mime-type, the system deletes the file and displays an appropriate error message.
Request
URI: /Files/Things/<thing id>/<path>/<filename>
HTTP Method: GET
Permissions:
<File>.r
Request Headers
| Parameter | Required | Description |
|---|---|---|
| Accept-Encoding | No | Retrieve compressed response
Only if you specify the value gzip or gzip,deflate for this parameter, the system returns the compressed response with an additional response header CONTENT-ENCODING with value gzip. If you specify an invalid value or do not use this header parameter, the system returns the uncompressed response. |
| Cache-Control: max-age | No |
Time duration in seconds Indicates the maximum amount of time in seconds for which the fetched responses can be reused (from the time the request is triggered). For example, max-age=120 indicates that fetched response can be reused (remains in the browser cache) for the next 120 seconds. |
Request Parameter
| Parameter | Required | Data Type | Description |
|---|---|---|---|
| id | Yes | string | Internal identifier for a thing. |
| path | No | string | Path where the file exists. |
| name | Yes | string | Name of the file. |
Request Example
-
Read the content of a file from a folder
/Files/Things/123/myfolder1/myfolder2/myfile.txt
-
Read a file
/Files/Things/123/myfile.txt
Response
Format: JSON
Response Status and Error Codes
| Code | Description |
|---|---|
|
200 |
File retrieved successfully |
Response Example
My First File