Skip to content

API

Meshtech API Public is an additional option for the users to work with the Device Management Portal.

It is possible to create the website, mobile app etc. and add integration with our API.

The users can:

  • authenticate
  • receive a filtered list of devices
  • get information about firmware
  • create a job that will update the firmware on multiple devices
  • track the status of jobs

Authentication

To authenticate, the Bearer JWT token must be received first.

The request includes the following URI and the request body:

Request

POST https://ops-api.meshtech.no/api/v1/auth/login

{
  "username": "yourUsername",
  "password": "yourPassword"
}

Upon success, the response is received:

Response

{
    "status": "SUCCESS",
    "authToken": "valueOfYourToken",
    "sessionId": null
}

To authenticate with with Meshtech API Public, authToken value is needed. Click Authorize and in a Value field write Bearer followed by space and JWT (a value of the received token).

Bearer valueOfYourToken

Note

We use Bearer JWT tokens for authentication which are alive 30 minutes.

Note

After authentication in Meshtech API Public, it is important not to reload the page in order to keep the authToken valid.

Examples

Get Max Devices Count

GET method in this example is used to get a maximum number of the devices available on Device Management Portal.

The request includes the following URI:

Request

GET https://iot-api.meshtech.no/api/v1/devices?MaxResults=2
Upon success, the response includes the following response body:

Response

{
  "nextToken": "AQJO0jgAvRuvOp51fsL4TQq9MSnN2jq42jPiQR1wKrSxc2AoUrXmy5rVZVXUC+pecvonDZbKEARyYE2fND57Edeobl/9XdYQLVAWph9xJmlmnVWAY4jzxhkYCw3EFTQBPGWNumPgMhi867FKq43YuhgKBFFM/S7JEW65zs7I/KKOGwa6zMuzEz1sSGb+bhACdIt239NIhDdJWg==",
  "items": [
    {
      "id": "bmac-c0141f68fc3d",
      "friendlyName": "MT10225",
      "modelNumber": "2011",
      "labels": [
        "Kyiv-office"
      ],
      "bootMode": null,
      "connectivity": {
        "connected": true,
        "timestamp": "2020-12-08T08:10:08.88Z"
      },
      "firmwareVersion": "3.4.1",
      "hardwareVersion": "1.0.0",
      "imei": null,
      "status": null
    },
    {
      "id": "bmac-ff30c49c590d",
      "friendlyName": "BLE-GW-card",
      "modelNumber": "2011",
      "labels": [
        "test-tag"
      ],
      "bootMode": null,
      "connectivity": {
        "connected": false,
        "timestamp": "2020-12-04T16:33:02.055Z"
      },
      "firmwareVersion": "3.3.0",
      "hardwareVersion": "1.0.0",
      "imei": null,
      "status": null
    }
  ]
}

Update Device Name

PUT method in this example is used to update the GW's name.

The request includes the following URI and the request body:

Request

PUT https://iot-api.meshtech.no/api/v1/devices/bmac-ff30c49c590d/friendly-name

{
  "name": "MT10225"
}

Upon success, the response includes the success (200) code.

Add New Tag

POST method in this example is used to add a new tag.

The request includes the following URI:

Request

POST https://iot-api.meshtech.no/api/v1/labels

{
  "label": "test-tag"
}

Upon success, the response includes the success (200) code.

Delete Device Tag

DELETE method in this example is used to delete one of the tags in a specific GW.

The request includes the following URI and the request body:

Request

DELETE https://iot-api.meshtech.no/api/v1/devices/bmac-ff30c49c590d/labels/test-tag

Upon success, the response includes the success (200) code.