Legacy REST API

SMART EMS system contains REST API with following function and endpoints:

  • ConfigureRouter: /api/configure-router

  • ActivateRouter: /api/activate-router

  • RouterStatus: /api/router-status

  • RouterStatusAll: /api/router-status-all

  • GetRouterTemplate: /api/router-template

  • DeleteRoute: /api/delete-router

  • RoutersNotConnected: /api/routers-not-connected

  • Templates: /api/templates

Only POST Method is allowed while using REST API. Requested data must be in JSON format and data in response returned by API is in JSON format as well. All dates (i.e. lastSeen) are formatted according to ISO 8601 (https://pl.wikipedia.org/wiki/ISO_8601). Example dates using this format:

2004-02-12T15:19:21+00:00 2005-01-02T03:01:45+01:00

Basic authentication is required to get access to the API. API users created in the administration panel will get an API key generated for them which must be sent with every request.

Endpoints with example domain is used in this documentation: https://example.com/ Please remember to change the example domain to your existing one or valid IP.

Example:

curl --header "Content-Type: application/json" --user username:key --data '{"Routers": [{"Serial": "RF123456"}]}' https://example.com/api/router-status

Option ‘–include’ may be added in need of requiring additional info from header like returned status code, returned content type, server name, cookies, date of the document, HTTP version etc.:

curl --include --header "Content-Type: application/json" --user username:key --data '{"Routers": [{"Serial": "RF123456"}]}' https://example.com/api/router-status

All requests and responses will be logged, alongside unsuccessful requests (wrong data format, permission denials, etc.).

Error response will be returned in case request with invalid data.

{"Status":"OK","RouterStatus":{"RF123456":"Router does not exist"}}

ConfigureRouter

Endpoint: /api/configure-router Test1: curl –header “Content-Type: application/json” –user username:key –data ‘{“Serial”:”RF123456”,”Activate”:1,”IMSI”:”cx”,”Templateid”:6}’ https://example.com/api/configure-router

Test2: curl –header “Content-Type: application/json” –user username:key –data ‘{“Serial”:”RF9151632340198”,”Activate”:1,”IMSI”:”262011406930205”,”Templateid”:1,”RouterVariables”:{“ExampleVariableName”:”ExampleVariableValue”,”Name”:”My office Router”}}’ https://example.com/api/configure-router

Parameter

Type

Obligatory

Comment

Serial

string

YES/NO

Parameter is obligatory when application is configured to use Serial as identifier

IMSI

string

YES/NO

Parameter is obligatory when application is configured to use IMSI as identifier

Activate

boolean

YES

Values are 1 (Enabled), anything else is interpreted as 0 (Disabled)

RouterType

integer

NO

One of constants value in src\SmartEms\ProjectBundle\Model\RouterTypeInterface If missing, will be used 1 as default (ROUTERTYPE_TK800)

Templatename

string

NO

Templateid

integer

NO

RouterVariables

string

NO

Variables has to be in valid JSON format, if not will result in error

ReinstallStartupConfig

boolean

NO

The default value is TRUE; Possible values are: 1 (True),  0 (False). Anything else will result in error