Mistake on this page? Email us

REST API

This document describes the Device Management Edge Core REST API.

HTTP request port

You must specify the HTTP port in your API request.

The default port number varies depending on distribution:

 Release/Distribution Port
Mbed Edge 8080
LmP 9101
Snap 8081

Getting Edge Core status information

Get Edge Core status

GET /status

Parameters:

None needed.

Response:

Response Description
200 Successful response containing information about Edge Core status.
400 Bad request - Returned when the URI cannot be parsed, such as incorrect parameters.
404 Not found - Returned when the URL is not found.
405 Bad method - When using wrong method, for example, POST.

Acceptable content type:

application/json

JSON content shows this response:

Field ID Description
account-id The ID of the account running Edge Core in Device Management.
edge-version The version of Edge Core.
endpoint-name Edge Core endpoint name.
internal-id The internal ID of the Edge Core device. Empty when not connected.
lwm2m-server-uri The LwM2M server URI from Device Management.
status "connecting", "connected" or "error"
error_code Device Management Client error code number, for example, 12. Present when status equals "error".
error_description For example: "Client in reconnection mode, DnsResolvingFailed". Present when status equals "error".

Example:

Request:

curl http://localhost:8080/status

Response:

[
  {"account-id":"","edge-version":"CR-0.3.2-EA-master-81415039a334136501ae0e3a806c309a5649bbef","endpoint-name":"015dbc47ca7602420a01640503c00000","internal-id":"01600ca18e73000000000001001000ec","lwm2m-server-uri":"coaps://mds-systemtest.dev.mbed.com:5684?aid=015e79ee85a902420a014b0200000000&iep=0165d6fb9e7c0000000000010010037f","status":"connected"}
]

Notes:

Although the connection status reflects the connection to Device Management, updates to its value may depend on the responsiveness of the connection between Edge and Device Management. It may take a while for the connection status to update. The time to update the connection status also depends on the socket keepalive parameters. For example, you may add the following to the ./config/mbed_cloud_client_user_config.h file:

#define MBED_CLIENT_TCP_KEEPALIVE_TIME 75
#define MBED_CLIENT_TCP_KEEPALIVE_INTERVAL 15
  • The keepalive time is the duration between two keepalive transmissions in idle condition.
  • The keepalive interval is the duration between two successive keepalive retransmissions if an acknowledgement to the previous keepalive transmission is not received.

The values are in seconds with the default values of 600 and 75.