Image Manager
Simple CRUD service for storing firmware image metadata and binaries.
Images ¶
Image Collection ¶
List All ImagesGET/image{?label}
Example URI
- label
string(optional) Example: "xyz"Filter returned images by given label.
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/jsonBody
[
{
"created": "2018-02-08T12:25:11.979313+00:00",
"confirmed": true,
"label": "ExampleFW",
"fw_version": "1.0.0-rc1",
"id": "b60aa5e9-cbe6-4b51-b76c-08cf8273db07"
},
{
"created": "2018-02-08T12:25:11.998107+00:00",
"confirmed": false,
"label": "ExampleFW",
"fw_version": "1.0.0-rc1",
"id": "51b39543-9de1-4751-9fe2-48c8d6038ba1"
},
{
"confirmed": false,
"created": "2018-02-22T21:30:39.740576+00:00",
"fw_version": "1.0.0-rc1",
"id": "c929e347-0cd3-4925-a9ed-44ec59f7a1b9",
"label": "ExampleFW"
}
]401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}Create a New ImagePOST/image/
Creates a new image based on a JSON object containing the following metadata. All fields are required, images with missing metadata fields will return an error.
-
label: “FW_Example” (string) - An informative human-readable label.
-
fw_version: “1.0.0” (string) - FW Semantic versioning info.
Example URI
Headers
Content-Type: application/json
Authorization: Bearer JWTBody
{
"label": "FW_Example",
"fw_version": "1.0.0"
}201Headers
Content-Type: application/json
Location: /image/test_imageSchema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"published_at": {
"type": "string"
},
"url": {
"type": "string",
"pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
}
},
"required": [
"label",
"published_at",
"url"
]
}400Returned when there is missing fields in creation request.
Headers
Content-Type: application/jsonBody
{
"message": "failed to parse input",
"errors": {
"label": [
"Missing data for required field."
]
}
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}Binary Collection ¶
List All BinariesGET/image/binary/
Example URI
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/jsonBody
[
"b60aa5e9-cbe6-4b51-b76c-08cf8273db07.hex"
]401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}Images ¶
Retrieve a single image metadataGET/image/{image_id}
Example URI
- image_id
guid(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID.
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/jsonBody
{
"label": "FW_Example",
"fw_version": "1.0.0"
}404Headers
Content-Type: application/jsonBody
{
"message": "No such image: efac",
"status": 404
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}DeleteDELETE/image/{image_id}
Example URI
- image_id
guid(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID.
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/jsonBody
{
"removed_image": {
"confirmed": true,
"created": "2019-05-02T20:09:30.981452+00:00",
"fw_version": "1.0.0-rc1",
"id": "b60aa5e9-cbe6-4b51-b76c-08cf8273db07",
"label": "ExampleFW"
},
"result": "ok"
}404Headers
Content-Type: application/jsonBody
{
"message": "No such image: efac",
"status": 404
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}Image Binaries ¶
All files should have a “.hex” extension.
Retrieve a single image binaryGET/image/{image_id}/binary
Example URI
- image_id
guid(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID.
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/octet-stream404Headers
Content-Type: application/jsonBody
{
"message": "No such image: 57852f31-a906-4d5f-a0c3-fde41ff64d",
"status": 404
}404Headers
Content-Type: application/jsonBody
{
"message": "Image does not have an binary file",
"status": 404
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}DeleteDELETE/image/{image_id}/binary
Example URI
- image_id
guid(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID.
Headers
Authorization: Bearer JWT200Headers
Content-Type: application/jsonBody
{
"result": "ok"
}404Headers
Content-Type: application/jsonBody
{
"message": "No such image: 57852f31-a906-4d5f-a0c3-fde41ff64d",
"status": 404
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}Add binary to an existing imagePOST/image/{image_id}/binary
Example URI
- image_id
guid(required) Example: 51b39543-9de1-4751-9fe2-48c8d6038ba1Unique ID.
Headers
Content-Type: multipart/form-data;boundary=BOUNDARY
Authorization: Bearer JWTBody
--BOUNDARY
Content-Disposition: form-data; name="image"; filename="image.hex"
Content-Type: application/octet-stream
0123456789
--BOUNDARY--200Headers
Content-Type: application/jsonBody
{
"image": "51b39543-9de1-4751-9fe2-48c8d6038ba1",
"message": "image uploaded"
}404Headers
Content-Type: application/jsonBody
{
"message": "No such image: 57852f31-a906-4d5f-a0c3-fde41ff64d",
"status": 404
}401Returned when there is no Authorization header or if it contains an invalid value.
Headers
Content-Type: application/jsonBody
{
"message": "No authorization token has been supplied",
"status": 401
}