Common Request, Response Headers and Codes

The Enlighted Manage (EM) supports standard REST-based APIs including XML and JSON messaging formats. Developers can write applications using REST APIs to query and retrieve information from the Manage. The sample responses to the web services are in JSON or XML format.

Common Request Headers

The following table describes request headers common to API requests.

Header Name

Description

Example

Hostname

Host name of the requested content. This parameter is required for HTTP 1.1

Em_ip_address or hostname (Manage server)

Content-Type

The MIME type of the body of the request (used with POST and PUT requests). Both content types are valid.

Application/XML or Application/JSON

Accept

Content types that are acceptable for the response. The response is displayed in the format specified in this field.

Application/XML or Application/JSON

ApiKey

Username and API Key

{$Username}

For example: bob

Authorization

SHA-1 authorization comprises Username, API key, and Timestamp. API Key can be obtained from EM in Administration -> User Management menu.

{sha1sum of $Username$APIKey$ts}

ts

Timestamp: Time, date, and day of the API call in milliseconds and UTC format
For example, 1448011348780

{$ts}

Common Response Headers

The following table describes response headers that are common to most responses.

Header Name Description Example
Server The name of the server that generated the response em_server
(Manage server)
Content-Type The content type of the response content in the body Application/JSON
Content-Length The response length in bytes 7582
Date The date and time the EM server responded Sat, 21 Jul 2015 17:06:51 GMT

Status Codes

Status codes define the response of the request to the client. The following table lists the status codes.

Status code Status Message Description
200 Ok Valid response, request successful

Error Codes

When there is an error, the header information contains:

  • Content-Type: Application/XML
  • An appropriate 3xx, 4xx status code.

The following table lists the error codes.

Error codes Error Message Description
302 Moved temporarily User not authenticated
400

Bad request:
Invalid Fixture ID, please correct and try again, or
Incorrect body format, please correct and try again

User input is invalid data, either an incorrect Fixture-id or body format.
401 Authentication failed User authentication failed
403 Request forbidden, Permission denied No access to the user
404

API not found:
This fixture ID does not represent an emergency fixture: this function is only supported by emergency fixtures, please select an appropriate fixture ID.

API not valid or not found, or when the command is issued to start an emergency lighting testing on a non-emergency lighting fixture.
408 API received after time expired API canceled
500 Internal Server Error:
Looks like the sensor is offline! Please resolve the issue and try again.
Sensor communication is reported not healthy.