POST api/v2.0/ResourceLibrary/InitiateUpload

Initiate a file upload for use in associating files to resource library entries. A small file (<= 5MiB) can be uploaded with a single PUT request using the upload URL contained in the response. Files larger than this threshold must be partitioned into smaller parts/chunks and those chunks uploaded individually via PUT requests with the upload URLs contained in the response.

Request Information

URI Parameters

None.

Body Parameters

request which specifies metadata associated to the file to be uploaded.

InitiateDirectUploadRequest
NameDescriptionTypeAdditional information
FileName

Name of the file to upload, including file extension.

string

Required

FileSizeBytes

Size, in bytes, of the file to upload. Max 2 GiB

integer

Range: inclusive between 1 and 2147483648

Request Formats

application/json, text/json

Sample:
{
  "FileName": "sample string 1",
  "FileSizeBytes": 2
}

application/xml, text/xml

Sample:
<InitiateDirectUploadRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/HigherLogic.API.Models.Enterprise.Request">
  <FileName>sample string 1</FileName>
  <FileSizeBytes>2</FileSizeBytes>
</InitiateDirectUploadRequest>

Response Information

Resource Description

Object key assigned to identify the file in the file repository once uploaded, one or more pre-signed URLs to which to PUT the specified file, or parts thereof for large files, and data used for multipart uploads when the file size specified in the request exceed a minimum threshold where multipart upload is required.

InitiateDirectUploadResponse
NameDescriptionTypeAdditional information
objectKey

Object key assigned to the uploaded file upon upload

string

None.

uploadUrls

URL(s) to which to upload the requested file using a HTTP PUT request. Files that are small enough to require only one URL can be uploaded without requiring the caller to complete a multipart upload. Large files will require partitioning the file into parts/chunks and uploading each part individually, then calling the multipart upload complete endpoint once all parts have completed upload for the file repository to put the large file back together from its parts.

Collection of string

None.

contentType

Specify this value in the ContentType header of the PUT request when a single upload URL is provided. This may be omitted for multipart uploads, in which case, the content type within the multipart property is to be used.

string

None.

multipart

Properties required to accomplish a multipart upload for file sizes large enough to require a multipart upload. Omitted when the file size is small enough not to require a multipart upload.

MultipartInitiatedUpload

None.

Response Formats

application/json, text/json

Sample:
{
  "objectKey": "sample string 1",
  "uploadUrls": [
    "sample string 1",
    "sample string 2"
  ],
  "contentType": "sample string 2",
  "multipart": {
    "uploadId": "sample string 1",
    "partSizeBytes": 2,
    "contentType": "sample string 3"
  }
}

application/xml, text/xml

Sample:
<InitiateDirectUploadResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/HigherLogic.API.Models.Enterprise.ResourceLibrary" />