Some resources support assets - media which can be attached to an individual resource by a tag. Resources which support assets expose the functionality in the following manner.
Any media added as an asset to a resource must be supplied in the request body as binary data. The Content-Type header must be supplied.
Warning
Failure to supply the Content-Type as a header will result in an error.
Note
The Content-Type sent will determine the file extension when the data is written.
Operation: POST /vehicle/1/assets/interior1
Request Headers: Content-Type:image/jpeg
Request body: <binary JPEG data>
Intent: add a JEPG to vehicle 1 with a tag of "interior1"
Status: 201 Created
Response body:
{
"interior1": "http://keazcdn.somewhere.fake/ASSETID.jpeg"
}
A client can either retrieve all assets for a resource or by supplying a tag at the end of the request path, choose a single asset.
Operation: GET /vehicle/1/assets/
Intent: fetch all assets for vehicle 1
Status: 200 OK
Response body:
{
"interior1": "http://keazcdn.somewhere.fake/ASSETID.jpeg"
}