Thanks to use case 4, DGT has a tool to be able to publish at any kilometer point on any of the national highways information it deems appropriate (warn them of possible dangers, publication of low-emission zones, activation of low-emission protocols, give recommendations at any point, section or area of the road network, etc.).
This documentation shows how integrating companies can access and consume this information together with the information published in use case 1 (v16 signals) and use case 2 (works and incidents).
Prerequisites for connection
-
For security reasons, the connections will be cloud-to-cloud. The request will be made from the cloud of the integrating company and never from the devices directly.
-
DGT 3.0 will provide a certificate and add the public IP of the server from where the requests will be made to a white list.
-
Once the above is obtained, a client will be configured in any type of language or platform that is capable of making REST API requests (such as Postman).
API REST
The REST API is hosted in the following domain:
Some points to keep in mind:
-
The certificates, during the integration testing period, will be self-signed, so SSL verification must be disabled.
-
The versioning of the API is built into the URL itself. It is not necessary to add any parameters in the headers.
Get token
For the validation of the user, a token must be obtained and attached in the body of the requests.
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/getToken
Example of correct answer:
{
"errorCode": 0,
"errorDesc": "OK",
"data": [
{
"token": "fc7d1a1864d8847f928bb05b16a4cad9db5c09b0c027881a798a904e5c269050"
}
]
}
Example of wrong answer:
{
"errorCode": 10,
"errorDesc": "Authorization error",
"data": []
}
Master tables
The API makes available to users a series of endpoints with the data that make up the main event:
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getCategories
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getChangeTables
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getEventsArea
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getModes
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getProvinces
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getRoads/:idProv
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getRoadsDirection
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getErrorCodes
-
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/mastertables/getTypesPmvv
The format will be:
{
"errorCode": 0,
"errorDesc": "OK",
"data": [
{
"id": 1,
"name": "Punto"
}
]
}
Obtain PMVs (information of use cases 1, 2 and 4)
In this endpoint you will obtain all the information published regarding use cases 1 (V16 signals), use case 2 (works and incidents) and use case 4 (publication by DGT Virtual Variable Message Panels) that are active at each moment.
The associated documentation can be found in the document DESCRIPCIÓN API BANDEJA DE SALIDA. The relationship between the LINCE incidents and the iconography is described in 20191010_DGT30_0.xlsx
https://bandejadesalida-dev.cmobility30.es:8443/api/1.0/getPmvvs
It is a POST type endpoint that requires to send a body in JSON format. This body will have at least two fields: idcompany (the cn of the certificate) and the token. In addition, others can be added to filter the content of the response.
{
"idcompany": "common_name_certificate",
"token": "d7ee3fe23e48e0898426bcbcac4e666b1e70070487c747a52e14c6c66a0483f8",
"type": 0,
"province": 28,
"road": "A2",
"kpfrom": 2,
"kpto": 50,
"direction": 3,
"mode": 3,
"category": 3,
"withgeom": 1
}
Response example:
{
"errorCode": 0,
"errorDesc": "OK",
"data": [
{
"pmvGeomWkt": null,
"pmvId": 120148781,
"pmvMsg": "General",
"pmvImg": "P50O",
"pmvType": 1,
"pmvProv": 37,
"pmvRoad": "N-630a",
"pmvPk": 322.0,
"pmvPkIni": 0.0,
"pmvPkFin": 0.0,
"pmvDirection": 1,
"pmvCategory": 0,
"pmvMode": null,
"pmvProvFin": 0,
"pmvRoadFin": null,
"pmvEvent": 0,
"gid": "GUID_Suc_3009137_3009137"
}
]
}
Example of request for PMVs in a Province
Type | Province | Road | PK Start | PK End | Direction | Mode | Category | Geometries |
---|---|---|---|---|---|---|---|---|
na | Madrid | na | na | na | na | na | na | Sí |
{
"idcompany": "common_name_certificate",
"token": "d7ee3fe23e48e0898426bcbcac4e666b1e70070487c747a52e14c6c66a0483f8",
"province": 28,
"withgeom":1
}
Swagger UI
The application makes a self-generated Swagger available to the user. It can be found at the following URL:
https://bandejadesalida-dev.cmobility30.es:8443/swagger-ui.html
You must have the certificate to access.
NAP - DATEXII
Through the operation GET to the endpoint / api / 1.0 / nap it is possible to obtain all the events that are published in the National Access Point of Spain that DGT is responsible for. The returned data set follows the DATEXII standard.
<?xml version="1.0" encoding="UTF-8"?>
<d2LogicalModel modelBaseVersion="1.0" xsi:schemaLocation="http://datex2.eu/schema/1_0/1_0 http://datex2.eu/schema/1_0/1_0/DATEXIISchema_1_0_1_0.xsd" xmlns="http://datex2.eu/schema/1_0/1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<exchange>
<supplierIdentification>
<country>es</country>
<nationalIdentifier>dgt</nationalIdentifier>
</supplierIdentification>
</exchange>
<payloadPublication xsi:type="_0:SituationPublication" lang="es" xmlns:_0="http://datex2.eu/schema/1_0/1_0">
.....................
.....................
</payloadPublication>
</d2LogicalModel>
The data usage guide is available at DATEXII User Guide. The DATEXII libraries with the Spanish extensions are available for download at parse libraries for DATEXII.