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
Parameter | Parameter type | Description |
---|---|---|
URL_smartroad | string | Address of the web server being accessed |
Function | string | Part of a URL that points to a specific resource or API function |
login | string | User credentials in the System. User login is indicated |
string | Alternative 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 | |
password | string | User password |
Function
, login
and password
are mandatory parameters
Besides, Description of the parameters of the Functions
request
Function | Function description |
---|---|
stat | Statistics data |
events | Receiving Events |
status | Equipment status information |
pvr | Information about objects registered in counting zones |
sensors | Detector Information |
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.
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 code | Error type | Description |
---|---|---|
400 | The 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. |
401 | Unauthorized | Required authentication information is missing or is not valid for the resource. Incorrect value in request authorization parameters |
403 | Forbidden | Access to the requested resource is denied: - The user does not have the required permissions. - Invalid value specified: sensor_id , project_id |
429 | Too many requests | Less 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 |
500 | Internal server error | An 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"
}
}