Skip to main content

Smartroad RESTful API 2.0

The SmartRoad system provides a RESTful API for developers to interact with external systems.

In general, a request to an external system to obtain an information using unified HTTP methods looks like this:

<url_smartroad>/api/<version>/<request>?login=<user_login>&password=<user_password>

The list of all API requests

RequestHTTP methodMethod description
loginPOSTJWT token obtainment
refreshPOSTToken update after expiring
eventsGETReceiving events
statusGETEquipment status information
statGETStatistics data
sensorsGETSensor information
rateGETTraffic flow rating by statistic data showcase
jamGETTraffic congestion situation rating

Request parameter list

ParameterDescription
url_smartroadThe address of called web-server.
versionThe API version. The parameter value depends on API user organization. Default value is 2.0. Any other endpoint (integration or other) can be used as well.
requestThe called API method.
loginA user's login in the System.
passwordA user's password.
usernameA user's login used for authorization by the login method.
emailA user's email.
sensorIdA unique identifier of the searched sensor.
project_idA unique identifier of the searched sensor's project.
sensorNameA name of the searched sensor. DEPRECATED an undesirable parameter.
startDate / fromThe start of time period.
endDate / toThe end of time period.
PLEASE NOTE

Request is a mandatory parameter

login and password are also mandatory parameters when JWT token is not used as authorization method

Error Handling

The SmartRoad system uses HTTP status codes to indicate the status of API requests. The HTTP status code is returned in the response header.

A list of status codes which could be received by users:

  • 200: OK
  • 400: Bad Request
  • 401: Unauthorized
  • 403: Forbidden
  • 404: Not Found
  • 429: Too many requests
  • 500: Internal Server Error

Here is the list of all the common errors, which could appear while sending any API requests:

Error codeDescription/messageObtaining method
400API not found or disabledMistakes/typos in request name occurred, recalling a non-existing request
429Too many requestsLess than a certain amount of time has passed between requests. The client application has been throttled and should not attempt to retry the request until a certain amount of time has passed.
500Internal server errorAn internal server error occurred while processing the request. The server encountered an unexpected internal error or crash.

Interaction with external systems

The system implements data transfer to external systems through RESTful API in the form of JSON messages at the request of an external system.

common-schema-of-data-transfer-to-external-systems

External systems interaction schema.

Data is collecting, processing, and sending according to the following algorythm:

  1. DT collects traffic flow data;
  2. The adapter generates data packets to send forward to database;
  3. Web-server receives a data request from an external system;
  4. Web-server processes the request, with a use of PostgREST requests and receives required data from database;
  5. Web-server generates and sends a response to the request.

Constraints

Please note

Sorb Engineering LLC reserves the right to add new fields without previous notice while maintaining backward compatibility. Please make sure that your software will be able to process the data with fields that may be added in the future without requiring changes in source code.