Skip to main content

SmartRoad RESTful API

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

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

URL_smartroad/api/integration/function?login=user_login&password=user_password

In the table below the request parameters are described

ParameterParameter typeDescription
URL_smartroadstringAddress of the web server being accessed
FunctionstringPart of a URL that points to a specific resource or API function
loginstringUser credentials in the System. User login is indicated
emailstringAlternative authorization method. It can be used instead of the login parameter. The value can contain both the user's email address specified in the profile during registration and the login in the System
passwordstringUser password
PLEASE NOTE

Function, login and password are mandatory parameters

Besides, Description of the parameters of the Functions request

FunctionFunction description
statStatistics data
eventsReceiving Events
statusEquipment status information
pvrInformation about objects registered in counting zones
sensorsDetector Information
TIP

You can interact with our API here.

Content Types

SmartRoad uses the JSON format for all the API requests and responses. The content type of the request and response is application/json.

Authentication

The system supports the JWT authentication. You can get the token by calling the API. This token will be used for all the subsequent API calls. The API endpoints require authentication.

HTTP requests

The SmartRoad REST API strives to use appropriate HTTP requests for each action.

  • The method GET is used for retrieving resources.
TAKE INTO ACCOUNT

The methods POST, PATCH, DELETE, UPDATE, for now are not used, but they may be implemented considering client requirements.

Error Handling

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

List of the HTTP status codes:

  • 200: Successfully
  • 400: The request failed
  • 401: Unauthorized
  • 403: Forbidden
  • 404: Resource Not Found
  • 429: Too many requests
  • 500: Internal Server Error

Some possible errors when accessing RESTful API methods are describe in the table below.

Error codeError typeDescription
400The request failed.
- Missing parameter: parameter_name – when a required parameter is missing in the request
- Syntax error – if there is a syntax error in the request
- Unknown parameter: parameter_name – if the parameter is specified incorrectly or a non-existent parameter is specified
The request could not be processed because it is not in the correct format or is invalid. Request syntax error, incorrect indication or absence of a required parameter.
401UnauthorizedRequired authentication information is missing or is not valid for the resource. Incorrect value in request authorization parameters
403ForbiddenAccess to the requested resource is denied:
- The user does not have the required permissions.
- Invalid value specified: sensor_id, project_id
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 internal unexpected error or crash

Error Response

If the API call was failed, the response body will contain the error message. The error message is a JSON object with the following structure:

{
"error": {
"status": 500,
"message": "Internal server error"
}
}