Back to top

Image-manager

Simple CRUD service for storing firmware image metadata and binaries

Images

Image Collection

List All Images
GET/image{?label}

Example URI

GET http://localhost:8000/image?label=
URI Parameters
HideShow
label
string (optional) 
Request
HideShow
Headers
Authorization: Bearer JWT
Response  200
HideShow
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
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "No authorization token has been supplied",
  "status": 401
}

Create a New Image
POST/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
HideShow
Headers
Content-Type: application/json
Authorization: Bearer JWT
Body
{
  "label": "FW_Example",
  "fw_version": "1.0.0"
}
Response  201
HideShow
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
HideShow
Headers
Content-Type: application/json
Authorization: Bearer JWT
Body
{
  "fw_version": "1.0.0"
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "failed to parse input",
  "errors": {
    "label": [
      "Missing data for required field."
    ]
  }
}

Binary Collection

List All Binaries
GET/image/binary/

Example URI

GET http://localhost:8000/image/binary/
Request
HideShow
Headers
Authorization: Bearer JWT
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  "b60aa5e9-cbe6-4b51-b76c-08cf8273db07.hex"
]

Images

Retrieve a single image metadata
GET/image/{image_id}

Example URI

GET http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07
URI Parameters
HideShow
image_id
guid (required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07

Unique ID

Request
HideShow
Headers
Authorization: Bearer JWT
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "label": "FW_Example",
  "fw_version": "1.0.0"
}

Delete
DELETE/image/{image_id}

Example URI

DELETE http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07
URI Parameters
HideShow
image_id
guid (required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07

Unique ID

Request
HideShow
Headers
Authorization: Bearer JWT
Response  200

Image Binaries

Retrieve a single image binary
GET/image/{image_id}/binary

Example URI

GET http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07/binary
URI Parameters
HideShow
image_id
guid (required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07

Unique ID

Request
HideShow
Headers
Authorization: Bearer JWT
Response  200
HideShow
Headers
Content-Type: application/octet-stream

Delete
DELETE/image/{image_id}/binary

Example URI

DELETE http://localhost:8000/image/b60aa5e9-cbe6-4b51-b76c-08cf8273db07/binary
URI Parameters
HideShow
image_id
guid (required) Example: b60aa5e9-cbe6-4b51-b76c-08cf8273db07

Unique ID

Request
HideShow
Headers
Authorization: Bearer JWT
Response  200

Add binary to an existing image
POST/image/{image_id}/binary

Example URI

POST http://localhost:8000/image/51b39543-9de1-4751-9fe2-48c8d6038ba1/binary
URI Parameters
HideShow
image_id
guid (required) Example: 51b39543-9de1-4751-9fe2-48c8d6038ba1

Unique ID

Request
HideShow
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
HideShow
Headers
Content-Type: application/json

Posting an binary to a non-existing image
POST/image/{image_id}/binary

Example URI

POST http://localhost:8000/image/51b39543-9de1-4751-9fe2-1asdasdsss4/binary
URI Parameters
HideShow
image_id
guid (required) Example: 51b39543-9de1-4751-9fe2-1asdasdsss4

Unique ID

Request
HideShow
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
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "No such image: 51b39543-9de1-4751-9fe2-1asdasdsss4",
  "status": 404
}

Generated by aglio on 05 Apr 2018