Request/Response Formats
Request Formats
All requests must:
- Be sent using the HTTPS protocol as any request made to an unsecure HTTP address will return an error.
- Include an API Key and signature. (see User Authentication for more information)
Requests can specify a response format - if no extension or a ".json" is appended to the method name a JSON response will be returned. Append a ".xml" to the end of the method name in order to receive results formatted as XML.
Below is a general templates for request URLs (please note, JSON requests do not need the ".json", as JSON is the default format):
https://<your subdomain>.<your domain>/api/<method_name><.json or .xml><optional parameters for GET requests>
For example, to retrieve list all files in the path "/" (url-encoded to %2F) sorted by oldest to newest in XML format, use the following URL:
https://<your subdomain>.<your domain>/api/file_list.xml?api_key=<your key>&path=%2F&sort_by=date_asc×tamp=<current time>&signature=<signature>
Response Formats
JSON Requests
To retrieve list all files in the path “/” sorted by oldest to newest in JSON format, use the following URL:
https://<your subdomain>.<your domain>/api/file_list?api_key=<your key>&path=%2F&sort_by=date_asc×tamp=<current time>&signature=<signature>
A successful response in JSON format would look like this:
{
"fileList":
{
"path":"\/",
"totalFiles":73,
"filesInPage":50,
"maxFilesPage":50,
"files": [
{
"id":1071256,
"name":"image1371675459160.jpg",
"type":"file",
"size":706638,
"formattedSize":"690.08 KB",
"path":"\/",
"formattedModDate":"6\/19\/13, 4:57 pm EDT",
"modDate":1371675460,
"jobNumber":"0",
"workspaceId":0,
"username":"jsmith",
"fileComments":3,
"scheduledDelete":0,
"restricted":0
}
],
"userSettings":
{
"admin":1,
"uploadFiles":1,
"batchUploadFiles":1,
"downloadFiles":1,
"batchDownloadFiles":1,
"deleteFiles":1,
"batchDeleteFiles":1,
"moveCopyFiles":1,
"batchMoveCopyFiles":1,
"renameFiles":1,
"createFolders":1,
"sendFiles":1,
"sendFilesNonUser":1,
"subAdmin":0
}
}
}
An example error response, in JSON format, would look like this:
{"error":{"title":"Authentication Failed","message":"Authentication parameters missing or invalid."}}
XML Requests
For example, to retrieve list all files in the path “/” sorted by oldest to newest in XML format, use the following URL:
https://<your subdomain>.<your domain>/api/file_list.xml?api_key=<your key>
&path=%2F&sort_by=date_asc×tamp=<current time>&signature=<signature>
When properly called, this URL should return the following results
<fileList>
<path>/</path>
<totalFiles>73</totalFiles>
<filesInPage>50</filesInPage>
<maxFilesPage>50</maxFilesPage>
<files>
<file>
<id>1071256</id>
<name>image1371675459160.jpg</name>
<type>file</type>
<size>706638</size>
<formattedSize>690.08 KB</formattedSize>
<path>/</path>
<formattedModDate>6/19/13, 4:57 pm EDT</formattedModDate>
<modDate>1371675460</modDate>
<jobNumber>0</jobNumber>
<workspaceId>0</workspaceId>
<username>jsmith</username>
<fileComments>3</fileComments>
<scheduledDelete>0</scheduledDelete>
<restricted>0</restricted>
</file>
</files>
<userSettings>
<admin>1</admin>
<uploadFiles>1</uploadFiles>
<batchUploadFiles>1</batchUploadFiles>
<downloadFiles>1</downloadFiles>
<batchDownloadFiles>1</batchDownloadFiles>
<deleteFiles>1</deleteFiles>
<batchDeleteFiles>1</batchDeleteFiles>
<moveCopyFiles>1</moveCopyFiles>
<batchMoveCopyFiles>1</batchMoveCopyFiles>
<renameFiles>1</renameFiles>
<createFolders>1</createFolders>
<sendFiles>1</sendFiles>
<sendFilesNonUser>1</sendFilesNonUser>
<subAdmin>0</subAdmin>
</userSettings>
</fileList>
An example error response, in XML format, would look like this:
<error>
<title>Authentication Failed</title>
<message>Authentication parameters missing or invalid.</message>
</error>