Version Controller APIs

Dieser Abschnitt zeigt die Rest-API-Endpunkte von Version Controller.

Register Device

POST /api/device/register

Register a device.

Request Headers
  • Content-Type – application/json

  • X-Access-Token – JWT-TOKEN

Example request:

$ curl --location --request POST 'https://vc-server/api/device/register' \
 --header 'Content-Type: application/json' \
 --header 'X-Access-Token: <JWT-TOKEN>' \
 --data-raw '{
   "mac": "your-device-mac",
   "firmware_version": "1.0",
   "name": "device-name",
 }'

Example response:

{
  "message": "Device inserted!"
}
{
  "message": "Device exists!"
}
Response Headers
Status Codes

Delete Device

DELETE /api/device/

Delete a device.

Request Headers
  • Content-Type – application/json

  • X-Access-Token – JWT-TOKEN

Example request:

$ curl --location --request DELETE 'https://vc-server/api/device/' \
 --header 'Content-Type: application/json' \
 --header 'X-Access-Token: <JWT-TOKEN>' \
 --data-raw '{
   "mac": "your-device-mac",
 }'

Example response:

{
  "message": "Device deleted!"
}
{
  "message": "Device does't exist!"
}
Response Headers
Status Codes

Get Device

GET /api/device/:mac

Get a device.

Request Headers
  • Content-Type – application/json

  • X-Access-Token – JWT-TOKEN

Example request:

$ curl --location --request GET 'https://vc-server/api/device/<device-mac>' \
 --header 'X-Access-Token: <JWT-TOKEN>'

Example response:

{
  "mac": "device-mac",
  "name": "device-name",
  "firmware-version": "device-firmware-version"
}
{
  "message": "Device does't exist!"
}
Response Headers
Status Codes

Get All Devices

GET /api/device/

Get all devices.

Request Headers
  • Content-Type – application/json

  • X-Access-Token – JWT-TOKEN

Example request:

$ curl --location --request GET 'https://vc-server/api/device/' \
 --header 'X-Access-Token: <JWT-TOKEN>'

Example response:

[
  {
  "mac": "device-mac",
  "name": "device-name",
  "firmware-version": "device-firmware-version"
  },
  {
  "mac": "device-mac",
  "name": "device-name",
  "firmware-version": "device-firmware-version"
  }
]
Response Headers
Status Codes

Get Report

GET /api/report/:type

Get report in json, xml, and pdf format.

reqheader Content-Type

application/json

reqheader X-Access-Token

JWT-TOKEN

Example request:

$ curl --location --request GET 'https://vc-server/api/report/<json/xml/pdf>' \
 --header 'X-Access-Token: <JWT-TOKEN>'

Example response:

[
  {
  "mac": "device-mac",
  "name": "device-name",
  "firmware-version": "device-firmware-version"
  },
  {
  "mac": "device-mac",
  "name": "device-name",
  "firmware-version": "device-firmware-version"
  }
]
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <element>
      <firmware-version>device-firmware-version</firmware-version>
      <mac>device-mac</mac>
      <name>device-name</name>
  </element>
  <element>
      <firmware-version>device-firmware-version</firmware-version>
      <mac>device-mac</mac>
      <name>device-name</name>
  </element>
</root>
:resheader Content-Type: application/json

:statuscode 200: No error
:statuscode 404: Not Found
:statuscode 401: JWT is not valid

Next Rollout

POST /api/device/next/rollout

Check next rollout

reqheader Content-Type

application/json

reqheader X-Access-Token

JWT-TOKEN

Example request:

curl --location --request POST 'https://vc-server/api/device/next/rollout' \
--header 'Content-Type: application/json' \
--header 'X-Access-Token: <JWT-TOKEN>' \
--data-raw '{
  "mac": "your-device-mac",
  "firmware_version": "1.0"
}'

Example response:

{
  "rollout_id": "84",
  "rollout_name": "new-demo-rollout",
  "priority": "1",
  "start_date": "2021-04-02 09:30:00",
  "version": "2.0",
  "firmware_id": "11"
}

If no rollout exists:

{}
resheader Content-Type

application/json

statuscode 200

No error

statuscode 404

Not Found

statuscode 401

JWT is not valid

Rollout Success

POST /api/device/success/rollout

Inform rollout status

Request Headers
  • Content-Type – application/json

  • X-Access-Token – JWT-TOKEN

Example request:

curl --location --request POST 'https://vc-server/api/device/success/rollout' \
--header 'Content-Type: application/json' \
--header 'X-Access-Token: <JWT-TOKEN>' \
--data-raw '{
  "mac": "your-device-mac",
  "firmware_version": "2.0"
  "rollout_id": "84"
}'

Example response:

{
  "message": "Successfully inserted!"
}
{
  "message": "Existing Record"
}
Response Headers
Status Codes