JSON API » files » files/get
Gets the fields of a file. If data=1 is specified, the file contents are also returned.
Input parameters
Does not require authentication if file is public, else requires authentication and the files role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | If not public | None |
| auth_password | String | Authentication password. | If not public | None |
| id | Integer | ID of file to get. | Yes | |
| data | Integer | 1 to return file contents, 0 not to. | No | 0 |
| encoding | String | "base64" to return file contents base64 encoded, "raw" to return raw data. | No | "raw" |
Responses
| Code | Description |
|---|---|
| 200 | Success. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 404 | The file does not exist, or you do not have permission to view it. |
Data returned
Fields of file.
Example: With required parameters
http://enswitch.example.com/api/json/files/get/?auth_username=user;auth_password=password;id=123{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123, "name":"example1.css", ... } }
Change history
| Version | Changes |
|---|---|
| 4.0 | Function added. |
