Uploads a whole file (up to 4 GB), or uploads a chunk of a file as a piece of the overall file upload process.
Base Request
POST /api/upload
Query Parameters
Parameter | Description | Type | Required | Notes |
---|---|---|---|---|
chunkCount | The total number of file chunks in the upload. | integer | Optional | None |
chunkIndex | The index position for this file chunk upload. | integer | Optional | The overall file chunk index starts at 0. |
chunked | True/false indicator or whether the upload includes file chunks. | Boolean | Optional | None |
encoding | The type of encoding used for text files. | string | Optional | None |
fileName | The name of the file to be uploaded. | string | Optional | None |
id | The ID of the file to be uploaded. | string | Optional | If the file ID is null, a new upload is created. |
mimeType | The MIME type of the file to be uploaded. | string | Optional | None |
Headers
Header Name | Description | Required | Values |
---|---|---|---|
Authorization | The access token | Required |
Bearer [access_token]
where [access_token] is a string generated when you complete authentication (see Getting Started) |
User-Agent | Identity of the client making the request to the server | Required |
[product]/[version]
where [product] is the name of the software you are using to make the request and [version] is the numbered version of the software (for example, MyCompanyProduct/1.0). For information on other types of values commonly included in user-agent request headers, see the User-Agent HTTP header reference section on the Mozilla developer documentation website. |
Accept | The format of the data to be returned | Optional | application/vnd.hxcs.v1+json |
Content-Type | The format of the data to be posted | Optional for client streaming; required for indirect streaming | */* for client streaming; text/uri-list for indirect streaming |
Sample Request: Client Streaming
The following is a sample request to upload a file using client streaming, which explicitly provides the set of bytes that make up the blob. For an example that provides a URI reference to the bytes that make up the blob instead, see Sample Request: Indirect Streaming.
POST /api/upload?chunkCount=5&chunkIndex=0&chunked=true&encoding=UTF-8
Authorization: Bearer [access_token]
User-Agent: MyCompanyProduct/1.0
Accept: application/vnd.hxcs.v1+json
Content-Type: image/jpeg
Sample Request: Indirect Streaming
The following is a sample request to upload a file using indirect streaming, which provides a URI reference to the bytes that make up the blob. For an example that explicitly provides the set of bytes that make up the blob instead, see Sample Request: Client Streaming.
POST /api/upload?chunkCount=5&chunkIndex=0&chunked=true&encoding=UTF-8 Authorization: Bearer [access_token] User-Agent: MyCompanyProduct/1.0 Accept: application/vnd.hxcs.v1+json Content-Type: text/uri-list # Authorization: Bearer [access_token] # Cookie: test=cookie https://www.example.com/images/earth/earth-night.jpeg
Response
See Upload for response body details and a sample response.
Status Codes and Errors
The following table lists the returned status codes.
Code | Description | Notes |
---|---|---|
201 | Created | Returns the upload information once the upload is complete. |
202 | Accepted | Returns the upload information after a chunk addition to the upload is complete. |
401 | Not Authorized | Authentication has failed or was not provided. |
403 | Not Allowed | Access permissions are invalid or missing. |
404 | Not Found | The upload with the specified ID could not be found. |