Image-manager
Simple CRUD service for storing firmware image metadata and binaries
Images ¶
Image Collection ¶
List All ImagesGET/image{?label}
Example URI
GET http://localhost:8000/image?label=
URI Parameters
- label
string
(optional)
Request
Headers
Authorization: Bearer JWT
Response
200
Headers
Content-Type: application/json
Body
[
{
"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"
}
]
Request
With no Authorization
Response
401
Headers
Content-Type: application/json
Body
{
"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 (string) - An informative human-readable label
-
fw_version (string) - FW Semantic versioning info
Example URI
POST http://localhost:8000/image/
Request
Headers
Content-Type: application/json
Authorization: Bearer JWT
Body
{
"label": "FW_Example",
"fw_version": "1.0.0"
}
Response
201
Headers
Content-Type: application/json
Location: /image/asdasdasdasdasdas
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net",
"type": "object",
"properties": {
"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"
]
}
Request
With Missing Fields
Headers
Content-Type: application/json
Authorization: Bearer JWT
Body
{
"fw_version": "1.0.0"
}
Response
400
Headers
Content-Type: application/json
Body
{
"message": "failed to parse input",
"errors": {
"label": [
"Missing data for required field."
]
}
}
Binary Collection ¶
List All BinariesGET/image/binary/
Example URI
GET http://localhost:8000/image/binary/
Request
Headers
Authorization: Bearer JWT
Response
200
Headers
Content-Type: application/json
Body
[
"b60aa5e9-cbe6-4b51-b76c-08cf8273db07.hex"
]
Images ¶
Retrieve a single image metadataGET/image/{image_id}
Example URI
GET http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07
URI Parameters
- image_id
guid
(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID
Request
Headers
Authorization: Bearer JWT
Response
200
Headers
Content-Type: application/json
Body
{
"label": "FW_Example",
"fw_version": "1.0.0"
}
DeleteDELETE/image/{image_id}
Example URI
DELETE http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07
URI Parameters
- image_id
guid
(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID
Request
Headers
Authorization: Bearer JWT
Response
200
Image Binaries ¶
Retrieve a single image binaryGET/image/{image_id}/binary
Example URI
GET http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07/binary
URI Parameters
- image_id
guid
(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID
Request
Headers
Authorization: Bearer JWT
Response
200
Headers
Content-Type: application/octet-stream
DeleteDELETE/image/{image_id}/binary
Example URI
DELETE http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07/binary
URI Parameters
- image_id
guid
(required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07Unique ID
Request
Headers
Authorization: Bearer JWT
Response
200
Add binary to an existing imagePOST/image/{image_id}/binary
Example URI
POST http://localhost:8000/image/51b39543-9de1-4751-9fe2-48c8d6038ba1/binary
URI Parameters
- image_id
guid
(required) Example: 51b39543-9de1-4751-9fe2-48c8d6038ba1Unique ID
Request
Headers
Content-Type: multipart/form-data;boundary=BOUNDARY
Authorization: Bearer JWT
Body
--BOUNDARY
Content-Disposition: form-data; name="image"; filename="image.hex"
Content-Type: application/octet-stream
0123456789
--BOUNDARY--
Response
200
Headers
Content-Type: application/json
Posting an binary to a non-existing imagePOST/image/{image_id}/binary
Example URI
POST http://localhost:8000/image/51b39543-9de1-4751-9fe2-1asdasdsss4/binary
URI Parameters
- image_id
guid
(required) Example: 51b39543-9de1-4751-9fe2-1asdasdsss4Unique ID
Request
Headers
Content-Type: multipart/form-data;boundary=BOUNDARY
Authorization: Bearer JWT
Body
--BOUNDARY
Content-Disposition: form-data; name="image"; filename="image.hex"
Content-Type: application/octet-stream
0123456789
--BOUNDARY--
Response
404
Headers
Content-Type: application/json
Body
{
"message": "No such image: 51b39543-9de1-4751-9fe2-1asdasdsss4",
"status": 404
}