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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.If not publicNone
auth_passwordStringAuthentication password.If not publicNone
idIntegerID of file to get.Yes
dataInteger1 to return file contents, 0 not to.No0
encodingString"base64" to return file contents base64 encoded, "raw" to return raw data.No"raw"

Responses

CodeDescription
200Success.
401The authentication details provided are invalid.
402Your role does not allow this.
404The 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

VersionChanges
4.0Function added.