The actual upload is performed using the uploadSegment endpoint (POST /ccadmin/v1/files/<token>, where <token> is the token generated in the startFileUpload call). You must call uploadSegment once for each file segment, and each time specify these three properties:
filename-- The pathname for the file, relative to the/thirdpartyfolder. This must match the filename used to generate the token.index-- The index for the file segment being loaded.file-- The based64-encoded content of the segment.
The following sample request uses the token generated by the startFileUpload call in the previous section to upload the first segment of a file:
POST /ccadmin/v1/files/18d396ba091fa_1755 HTTP 1.1
Authorization: Bearer <access_token>
{
"filename": "myfolder/sampleFile.txt",
"index": 0,
"file": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZ
WxpdC4gTWF1cmlzIGF1Y3RvciBmZXVnaWF0IGp1c3RvLCBpZCB1bHRyaWNlcyBsb3JlbSBzb2RhbGVzI
HNpdCBhbWV0LiBJbiBhdWN0b3Igc2VkIHNlbSBldCBpYWN1bGlzLiBNYWVjZW5hcyBiaWJlbmR1bSBua
XNsIG5lcXVlLiBBZW5lYW4gYXQgb3JuYXJlIGRpYW0uIEZ1c2NlIGlkIGRpZ25pc3NpbSBsb3JlbSwgc
nV0cnVtIGNvbmRpbWVudHVtIGxlY3R1cy4gUGVsbGVudGVzcXVlIHZhcml1cyBjb25zZWN0ZXR1ciBtZ
XR1cyBub24gc2FnaXR0aXMuIEludGVnZXIgZXN0IHF1YW0sIGRpZ25pc3NpbSBub24gbGVjdHVzIG5lY
ywgY29udmFsbGlzIGNvbnZhbGxpcyBuaXNpLiBFdGlhbSBpbiBlZmZpY2l0dXIgbnVsbGEuIFN1c3Blb
mRpc3NlIGVnZXQgdGluY2lkdW50IHR1cnBpcywgbmVjIHRlbXB1cyB1cm5hLiA="
}For a multi-segment upload, the response body for each segment but the last is similar to this:
{
"success": true,
"links": [
{
"rel": "self",
"href":
"http://myserver.example.com:7002/ccadmin/v1/files/18d396ba091fa_1755"
}
]
}For a single-segment upload, or the last segment of a multi-segment upload, the response body is similar to this:
{
"result": {
"@class": "atg.cloud.file.ThirdPartyUploadResultSummary",
"failedFiles": 0,
"allFilesFailed": false,
"newFiles": 1,
"modifiedFiles": 0,
"unzipped": false,
"failedFilesReasons": {}
},
"success": true,
"links": [
{
"rel": "self",
"href":
"http://myserver.example.com:7002/ccadmin/v1/files/18d396ba091fa_1755"
}
]
}
