REST Other File Object APIs
Resource URL Summary
Retrieve metadata for all Files of a given type
GET /up/v5/object/${objectType}/${typeId}/${segment1*}/$
{segment2*}?metadata=true
* the query parameter metadata is options, when it presents, the response will include the metadata info from here
Upload one or more Files of a given type
POST /up/v5/object/${objectType}/${typeId}
/${segment1*}/$
{segment2*}
--header 'obj-meta-title: titleFromMetadata' \
--header 'obj-meta-cc: j.zhang@sp.com' \
* there header parameters are optional, when they presents, they will be sent to s3 object metadata, and retrieved with GET call with metadata query parameters.
Delete a File
DELETE /up/v5/object/${objectType}/${typeId}
/{segment1}/
{segment2*}
HTTP Headers
This API uses the standard ServiceBroker HTTP Headers.
API Specific Parameters
Parameter | Type | Required? | Description |
---|---|---|---|
|
| Yes | The type of file-based data being managed. Must be one of the following values:
|
${typeId} | string | Yes | The unique string ID value of the Work Item that the File object is associated with. |
| string | No | segment of File Object s3 key |
| string | No | segment of File Object s3 key |
API Specifics
Retrieve metadata for all Files of a given type
This REST API will return the metadata for all File objects of a given type that are associated with a given Work Item.
URL
GET /up/v5/object/${objectType}/${typeId}
HTTP Request Body
This request does not require a request body.
HTTP Response
Success
On success, an HTTP response code of 200 will be returned, and the response body will be a JSON object of the following format:
{ "Type": "10", "FileObjects": [ { "Fieldname": "The name of the field specified in the multipart/form-data request when uploaded", "OriginalName": "Original name of the File when uploaded", "Encoding": "Encoding type of the File", "Mimetype": "Mime type of the File", "Size": "Size of the File in bytes", "UploadDTM": "Date/Time the File was uploaded", "PhotoURL": "URL to the File contents", "ThumbnailURL": "URL to a thumbnail version of the File contents", "Metadata": { // this will be present when the query parameter metadata=true presents. "cc": "j.zhang2@sp.com", "title": "titleFromMetadata1" } } ] }
Error
Otherwise, on error, the API will:
- Return an HTTP response code of 400, if the request was invalid;
- Return an HTTP response code of 401, if the request was not authorized; or
- Return an HTTP response code of 500, if something else went wrong.
Both HTTP 400 and 500 responses will contain a REST Integration Standard Response Object with appropriate values for the Code
and/or Message
fields, describing the error, in the response body.
Upload one or more Files of a given type
This REST API allows one or more File objects to be uploaded and associated with the given Work Item.
URL
POST /up/v5/object/${objectType}/${typeId}
--header 'obj-meta-title: titleFromMetadata1' \
--header 'obj-meta-cc: j.zhang2@sp.com'
HTTP Request Body
A standard multipart/form-data
body must be included with the request.
The multipart/form-data
body specification can be found in RFC 2388, however, the following links may also be of assistance:
- Stack Overflow thread regarding
multipart/form-data
. - Using curl to upload files using
multipart/form-data
.
HTTP Request Header
The optional request headers MUST starts with 'object-meta-', which will be store as s3 object metadata.
HTTP Response
Success
On success, an HTTP response code of 200 will be returned.
Error
Otherwise, on error, the API will:
- Return an HTTP response code of 400, if the request was invalid;
- Return an HTTP response code of 401, if the request was not authorized; or
- Return an HTTP response code of 500, if something else went wrong.
Both HTTP 400 and 500 responses will contain a REST Integration Standard Response Object with appropriate values for the Code
and/or Message
fields, describing the error, in the response body.
Delete a File
This REST API deletes all File objects from the specified Work Item.
There is currently no support for deleting a single File object.
URL
DELETE /up/v5/object/${objectType}/${typeId}
HTTP Request Body
This request does not require a request body.
HTTP Response
Success
On success, an HTTP response code of 200 will be returned.
Error
Otherwise, on error, the API will:
- Return an HTTP response code of 400, if the request was invalid;
- Return an HTTP response code of 401, if the request was not authorized; or
- Return an HTTP response code of 500, if something else went wrong.
Both HTTP 400 and 500 responses will contain a REST Integration Standard Response Object with appropriate values for the Code
and/or Message
fields, describing the error, in the response body.