API Documentation

Upload File

The file upload is performed by invoking a multipart/form-data POST to the <storage endpoint url>/saveFile.php (from Storage Endpoint GET). The endpoint URL must be the storage endpoint that hosts the referenced syncpoint.

Files larger than 5 MB should be uploaded in 5 MB chunks as follows:

  1. Upload the first 5 MB chunk of the file and be sure to not include the fileDone body part (unless the file is less than 5 MB in size).
  2. The successful HTTP response will be “Resume Incomplete” and the HTTP response code will be “308 Redirection” if this chunk is not the last one, and the HTTP response will be “Stored” and the HTTP response code will be will be “200 OK” if this is the last chunk.
  3. If there is more than one chunk, Read the ETag HTTP header returned in the response.
  4. You can also read the Range HTTP header returned in the response which includes the byte range of the successful chunk upload.
  5. Upload the second 5 MB file chunk and be sure to include the If-Match HTTP header with the value set to the ETag value from step 3 above. ONLY include the fileDone body part if this is the last chunk.
  6. The successful HTTP response will be “Resume Incomplete” and the HTTP response code will be “308 Redirection” if this chunk is not the last one, and the HTTP response will be “Stored” and the HTTP response code will be will be “200 OK” if this is the last chunk.
  7. You can also read the Range HTTP header returned in the response which includes the byte range of all successful chunk uploads.
  8. If there are more chunks then upload the next one and be sure to include the If-Match HTTP header with the value set to the ETag value from step 3 above. ONLY include the fileDone body part if this is the last chunk.
  9. The successful HTTP response will be “Resume Incomplete” and the HTTP response code will be “308 Redirection” if this chunk is not the last one, and the HTTP response will be “Stored” and the HTTP response code will be will be “200 OK” if this is the last chunk.
  10. You can also read the Range HTTP header returned in the response which includes the byte range of all successful chunk uploads.
  11. Repeat steps 8, 9 and 10 until the last chunk has been uploaded.

 

The multi-part body (see http://tools.ietf.org/html/rfc2388) of file upload POST requests must include:

  • fileData: Binary contents of the file
  • sha256: SHA-256 hash of the contents of the file
  • sessionKey: Machine bearer token issued by the Syncplicity authentication service.
  • virtualFolderId: ID of the Syncplicity folder where the file is located
  • creationTimeUtc: File creation date and time
  • lastWriteTimeUtc: File updated date and time
  • fileDone: ONLY included with the last chunk of a file. If the file size is less than 5 MB then this body part will be included with the first and only chunk.

Resource URL

<storage endpoint url>/saveFile.php?filepath={FILE_PATH}

 

HTTP Headers Parameters

 

Name Value Description
As-User (optional) Valid user GUID A Global Administrator, or eDiscovery Administrator who has been assigned the corresponding privilege, can enter another user’s GUID so that all Content API actions are performed on behalf of that user. If this header is not used or the Administrator has not been assigned the corresponding privilege, the API works on behalf of the currently authenticated Global or eDiscovery Administrator.
AppKey (required) <app_key> Consumer Key of the app
Authorization(required) Bearer  <token> Bearer token 
Syncplicity-Storage-Authorization (required for SVA)   Storage token for a StorageVault configured with Authentication
Content-Type (required) multipart/form-data; boundary=-------<upload time in ticks> Content type of request with upload time in ticks
If-Match (optional) <ETag> ETag of file upload session. It is returned from server after very first chunk is uploaded.
Content-Encoding gzip Content compression
Content-Range */* <strartByte>-*/* For non-chunked upload For chunked upload
Content-Encoding (optional) gzip Content compression

 

URL Query Parameters

Param Name Required Description Data Type Valid Values
filepath={FILE_PATH} Yes

Virtual file path from syncpoint view. Includes file name.

Example: %5Csubfolder1%5C1234.txt

NOTE: Use %5C instead of a backslash (\).

String  

 

Form Data

Name Value Description
Content-Disposition: form-data; name="fileData"; filename="<file name>" Content-Transfer-Encoding: binary Content-Type: application/octet-stream <file content> <file name> - name of the uploading file <file stream> - file content
Content-Disposition: form-data; name="sha256"   SHA256 hash of file content
Content-Disposition: form-data; name="virtualFolderId" <int> Virtual folder id
Content-Disposition: form-data; name="creationTimeUtc"   File creation date time in ISO 8601 format
Content-Disposition: form-data; name="lastWriteTimeUtc"   File change date time in ISO 8601 format
Content-Disposition: form-data; name="fileDone"   Marker of last file chunk

 

Sample Form Data

Content-Disposition: form-data; name="fileData"; filename="1234.txt"
Content-Transfer-Encoding: binary
Content-Type: application/octet-stream <file>
Content-Disposition: form-data; name="sha256" 688787d8ff144c502c7f5cffaafe2cc588d86079f9de88304c26b0cb99ce91c6
Content-Disposition: form-data; name="sessionKey" Bearer Y1FzUQHuRAk2MTY41cga9hxP9yPO
Content-Disposition: form-data; name="virtualFolderId" 4250509
Content-Disposition: form-data; name="creationTimeUtc" 2015-10-27T23:07:54.3268208Z
Content-Disposition: form-data; name="lastWriteTimeUtc" 2015-10-27T23:08:02.4128366Z
Content-Disposition: form-data; name="fileDone"

 

Sample Response

Stored

 

Response Definitions

Response body may contain the following values:

 

Stored File is successfully stored
Already Stored File with the same content was already stored
Resume Incomplete File chunk has been successfully stored, but the final chunk has not yet been received

 

Response Error Details

HTTP Code Error Code Description
400 (Bad request) Bad request
401 (Not authorized) Invalid authorization or storage token