Skip to main content

Firmware API

When an OKM calls the OKM service, the service checks if the OKM has the most recent version. If the OKM needs a more recent firmware, the service replies with a URL indicating where to download the firmware.

The purpose of the Firmware API is to create, read, update, delete the URLs that the OKM uses to download its firmware files.

Currently, the Firmware API supports CRUD operations for the following types of firmware:

  1. OKM Firmware
  2. Batch Key Firmware
  3. LoRa Key Firmware

Data Model

A firmware entry in the database represents a URL that points to the file associated with a specific version of a firmware for a particular type.

Currently, the database includes entries for two types of firmware: OKM and IR4KEY.

ColumnTypeDescription
idUUID v4Unique id of the firmware entry.
typeVARCHARType of firmware: OKM, IR4KEY for now.
versionVARCHARVersion number of the firmware.
urlTEXTThe full URL to the file (including the file name).

GET

Get a Firmware Entry by its id.

Example request:

GET https://api.invue.com/api/v1/firmware/{{id}}

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"msg": "Firmwares fetched successfully",
"data":
{
"id": "421d73aa-af8f-467f-a8e8-ee1331378ea8",
"type": "OKM",
"version": "01932023020111482",
"url": "https://storage.googleapis.com/<BUCKET_NAME>/<FIRMWARE_FILE_NAME>.bin&alt=media"
}
}

Possible errors:

Error codeDescription
401 UnauthorizedThe accessToken is invalid or has been revoked.
404 Not FoundThe firmware entry was not found.

POST

Sending a POST to the okm endpoint will create a firmware entry.

At this time, there are two types of firmware entries : OKM and IR4KEY .

Example request:

POST https://api.invue.com/api/v1/firmware

{
"type": "OKM",
"version": "01932023020111482",
"url": "https://storage.googleapis.com/<BUCKET_NAME>/<FIRMWARE_FILE_NAME>.bin&alt=media"
}

The response for success:

HTTP/1.1 201 OK
Content-Type: application/json; charset=utf-8
 {
"status": true,
"msg": "Firmware created successfully",
"data": {
"id": "421d73aa-af8f-467f-a8e8-ee1331378ea8",
"type": "OKM",
"version": "01932023020111482",
"url": "https://storage.googleapis.com/<BUCKET_NAME>/<FIRMWARE_FILE_NAME>.bin&alt=media"
}
}

If a firmware entry for the same version already exists:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
{
"errors": [
{
"status": 400,
"detail": "duplicate key value violates unique constraint \"firmware_type_version_key\""
}
]
}

Possible errors:

Error codeDescription
400 Bad RequestValidation failed for the request.
401 UnauthorizedThe accessToken is invalid or has been revoked.

PUT

Sending a PUT to the Firmware config endpoint will update a firmware entry .

PUT https://api.invue.com/api/v1/firmware/{{firmware-id}}

Example request:

{ 
{
"id": "421d73aa-af8f-467f-a8e8-ee1331378ea8",
"type": "OKM",
"version": "01932023020111482",
"url": "https://storage.googleapis.com/<BUCKET_NAME>/<FIRMWARE_FILE_NAME>.bin&alt=media"
}
}

The response for success:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"status": true,
"msg": "Firmware updated successfully",
"data": {
"id": "421d73aa-af8f-467f-a8e8-ee1331378ea8",
"type": "OKM",
"version": "01932023020111482",
"url": "https://storage.googleapis.com/<BUCKET_NAME>/<FIRMWARE_FILE_NAME>.bin&alt=media"
}
}

If firmware config does not exist.

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
{
"errors": [
{
"status": 400,
"detail": "Failed to update firmware"
}
]
}

Possible errors:

Error codeDescription
400 Bad RequestBad Request. Validation failed for the request.
401 UnauthorizedThe accessToken is invalid or has been revoked.

DELETE

Delete a firmware entry by its id.

Example request:

DELETE https://api.invue.com/api/v1/firmware/{{id}}}

Returns a 204 with an empty body.

Possible errors:

Error codeDescription
401 UnauthorizedThe accessToken is invalid or has been revoked.
404 Not FoundThe firmware entry is not found.

PATCH

Not supported, the request will return

Error codeDescription
405 Method Not AllowedCannot PATCH