Large File Upload
Added by IBM contributorPaul Bastide | Edited by Andre W Fischer on May 21, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

The large file upload API is a two phase request to upload large files to IBM Connections Files

Large file must be uploaded with multi-phase upload API. Multi-phase API consists of 2 phases. Phase 1 is to initialize a upload session.  Phase 2 is to upload the file content.

Multi-phase API is based on existing file upload APIs. When special headers are present with the old API request, server will handle it as multi-phase upload requests.

 

The request is the same as old API except that request body should be content of file only. Multi-part/form request is not allowed. The request can carry url parameters or custom headers which will override the value set in phase 1 request. However, it is not recommended as meta-data conflict can cause file uploading to fail.

Input
Method URI Description
POST /library/{libraryId}/feed create a large file in a library
PUT /library/{libraryId}/document/{documentId}/entry Updates a given file with a large file
Name Type Optional Description
format
enumerated Yes Format of the response body. json returns HTML whose body is a quoted JSON feed, xml returns an Atom feed.
Authorized values:
  • xml
  • json
Name Type Optional Description
X-IBM-UPLOAD-METHOD
enumerated No Used in Phase 1 and 2 of the Large File Upload
The only valid value is phases
Authorized values:
  • phases
X-IBM-UPLOAD-SIZE
string No Used in Phase 1 of the upload, indicates the size of the object in bytes
X-IBM-UPLOAD-TOKEN
string No Only used in Phase 2, the token is the value returned from the Phase1 response. It must be included in the upload header
Output
Content Type: application/atom+xml
Name Type Optional Description
X-IBM-UPLOAD-TOKEN
string No Only returned in Phase 1, Token which is to be set in phase 2 request with file content.
Code Description
200
OK. Indicates that the request was received successfully. In Phase 1, means you can go to Phase 2
403
Forbidden. The server refuses to fulfill a request, typically because the request was for an object that you don't have permission to access.
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
Examples
Requests to Upload a Large File
POST  /files/basic/api/library/b2d75784-1f8d-49d2-8a88-0379960bcdb5/feed

X-IBM-UPLOAD-METHOD: phases
X-IBM-UPLOAD-SIZE: 1005

Response returned by the server
The response headers contain
X-IBM-UPLOAD-TOKEN: b96a8702-9c1b-477c-be9a-6d6f10b071ee
POST /files/basic/api/library/b2d75784-1f8d-49d2-8a88-0379960bcdb5/feed

X-IBM-UPLOAD-METHOD: phases
X-IBM-UPLOAD-TOKEN: b96a8702-9c1b-477c-be9a-6d6f10b071ee

POST /files/basic/api/library/20670b98-5eb2-4f30-b59c-5daba83e3c45/document/3edb0960-6b81-4d39-9f11-2cd5b0fc7e33/entry

X-IBM-UPLOAD-METHOD: phases
X-IBM-UPLOAD-SIZE: 1005

X-Method-Override: PUT

Response returned by the server
X-IBM-UPLOAD-TOKEN: b96a8702-9c1b-477c-be9a-6d6f10b071ee
Phase 2 - Update Large File
POST /files/basic/api/library/20670b98-5eb2-4f30-b59c-5daba83e3c45/document/3edb0960-6b81-4d39-9f11-2cd5b0fc7e33/entry

X-IBM-UPLOAD-METHOD: phases
X-IBM-UPLOAD-TOKEN: b96a8702-9c1b-477c-be9a-6d6f10b071ee

X-Method-Override: PUT