Z

zbe

The Low Emissions Zones Publication Service is dedicated to the management of information related to the ZBE by the City Councils.

The objective of this service is to collect alphanumerical and geometric data from the ZBE received from the Town Councils that manage them, and to publish said information in a standardized format.

Both the publication and subscription functionality require different access certificates that must be requested and supplied by DGT 3.0. These certificates, if they have not already been requested, must be requested from soporte@cmobility30.es.

Below are the URLs with which each functionality is accessed:

Mode urls Description
Publication https://pre.cmobility30.es/zbe Client Integration Environment Endpoint for Publishing

The functionalities are described below.

Pub

This use case has a REST API for the publication (sending) of the data by the companies that so wish. Details of this can be found in the following sections:

  • The general details to make a request:

General Autenticación · (cmobility30.es)

Information related to the attributes of the ZBE

{
 "type": "Feature",
 "geometry": {
   "type": "Polygon",
   "coordinates": [
       [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
       [100.0, 1.0], [100.0, 0.0] ]
       ]
 },
 "properties": {
   "name": "Madrid",
   "city_ine": [28079,28002],
   "excluded": false
 }
}
Attribute Description
Type Geometry Type
name Name of the entity that manages the ZBE. It can be a City Council or entity, such as the Metropolitan Area of XXXXXX
city_ine Array with the INE codes of the municipalities it manages
excluded Indicates if the geometry is excluded from the ZBE, since it is within it but the traffic is allowed

Information regarding the information on the restriction

{
   "name": "Madrid",
   "city_ine": [28079,28002],
   "affected_labels": [1,4,2],
   "access_conditions": "Condiciones ejemplo",
   "information_url": "https://www.ayto.es/infoxxxxx",
   "timetable":[[“L”,"08:00:00", "16:00:00"], [“F”,"18:00:00", "20:00:00"]],
   "start_time": "2021-10-17T20:58:38Z"
}
Attribute Description
name Name of the entity that manages the ZBE. It can be a City Council or entity, such as the Metropolitan Area of XXXXXX
city_ine Array with the INE codes of the municipalities it manages
affected_labels Type of vehicles affected environmental labels
access_conditions ZBE access conditions
information_url URL where ZBE information is described
timetable ZBE application timetable. This may be different for Weekdays “L”, or Holidays “F”
start_time Expected effective date

Errors

As stated above, all HTTP responses other than 200 – OK can be considered invalid. The format of the error response is like the following example:

{
    "status": 401,
    "code": 1,
    "message": "User not found or valid"
}

These errors will have three main categories:

Auth

  • HTTP Status: 401 - Unauthorized

    Code Message
    1 User not found or valid

Client

  • HTTP Status: 400 - Bad Request

    Code Message
    0 Authenticate
    1 Incorrect token received
    2 Expired token received
    3 There is an error with the token provided. Please request a new one
    4 No token received
    5 Required request body is missing
    6 Missing request header
    7 Access denied role

In the case of obtaining an error 3 - Missing required property, the response obtained will have a value in the message that will indicate the fields that are missing to be sent:

{
    "status": 400,
    "code": 0,
    "message": "Authenticate"
}

Server

  • HTTP Status: 500 - Internal Server Error

    Code Message
    13 Internal error

Methods

The access methods to the REST API of the application are the following:

Create or update the attributes of a ZBE

Both for creating and updating the attributes of a ZBE. If the ZBE is new, it will be created, and if it already exists, its values will be updated.

Information about the endpoint:

  • Method: POST

  • URL: {baseUrl}/v1/zbeattr

  • Body:

{
 "type": "Feature",
 "geometry": {
   "type": "Polygon",
   "coordinates": [
       [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
       [100.0, 1.0], [100.0, 0.0] ]
       ]
 },
 "properties": {
   "name": "Madrid",
   "city_ine": [28079,28002],
   "excluded": false
 }
}
Attribute Description
name Name of the entity that manages the ZBE. It can be a City Council or entity, such as the Metropolitan Area of XXXXXX
city_ine Array with the INE codes of the municipalities it manages
affected_labels Type of vehicles affected environmental labels
access_conditions ZBE access conditions
information_url URL where ZBE information is described
timetable ZBE application timetable. This may be different for Weekdays “L”, or Holidays “F”
start_time Expected effective date

Deleting the attributes of a ZBE

Delete the attributes of a ZBE. Only the creator can remove them.

Information about the endpoint:

  • Method: DEL

  • URL: {baseUrl}/v1/zbeattr

  • Body:

{
 "type": "Feature",
 "geometry": {
   "type": "Polygon",
   "coordinates": [
       [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
       [100.0, 1.0], [100.0, 0.0] ]
       ]
 },
 "properties": {
   "name": "Madrid",
   "city_ine": [28079,28002],
   "excluded": false
 }
}

List available LEZs

List the ZBEs available in the system.

Information about the endpoint:

  • Method: GET

  • URL: {baseUrl}/v1/listzbe

  • Body:

{
 "ts": "2022-06-10T13:15:05Z",
 "zbes": [
        {
        "name": "Madrid",
        "city_ine": [28079,28002],
        "excluded": false
        },
        {
        "name": "Barcelona",
        "city_ine": [08001,08002],
        "excluded": false
        }
 ]
}
Attribute Description
ts UTC instant of list generation
zbes Array with the attributes of the available ZBEs

Get attributes of a ZBE

Returns the attributes of the requested ZBE.

Information about the endpoint:

  • Method: POST

  • URL: {baseUrl}/v1/zbeattr/{ine_cod}

  • Body:

Create or update LEZ restriction information

Both for the creation and updating of the restriction information of a ZBE. If with new, it will be created, and if it already exists, its values will be updated.

Information about the endpoint:

  • Method: POST

  • URL: {baseUrl}/v1/zberestric

  • Body:

{
   "name": "Madrid",
   "city_ine": [28079,28002],
   "affected_labels": [1,4,2],
   "access_conditions": "Condiciones ejemplo",
   "information_url": "https://www.ayto.es/infoxxxxx",
   "timetable":[[“L”,"08:00:00", "16:00:00"], [“F”,"18:00:00", "20:00:00"]],
   "start_time": "2021-10-17T20:58:38Z"
}
Attribute Description
name Name of the entity that manages the ZBE. It can be a City Council or entity, such as the Metropolitan Area of XXXXXX
city_ine Array with the INE codes of the municipalities it manages
affected_labels Type of vehicles affected environmental labels
access_conditions ZBE access conditions
information_url URL where ZBE information is described
timetable ZBE application timetable. This may be different for Weekdays “L”, or Holidays “F”
start_time Expected effective date

Obtaining restriction information from a ZBE

Returns the latest restriction information for a ZBE.

Information about the endpoint:

  • Method: POST

  • URL: {baseUrl}/v1/getzberestric/{ine_cod}

  • Body:

All restrictions for that ZBE are returned

  • Body:
{
    "name": "Madrid",
    "city_ine": [28079,28002],
    "restrictions": [
                {
                "affected_labels": [1,4,2],
                "access_conditions": "Condiciones ejemplo",
                "information_url": "https://www.ayto.es/infoxxxxx",
                "timetable":[[“L”,"08:00:00", "16:00:00"], [“F”,"18:00:00", "20:00:00"]],
                "start_time": "2021-10-17T20:58:38Z"
                },
                {"affected_labels": [3,5],
                "access_conditions": "Condiciones ejemplo",
                "information_url": "https://www.ayto.es/infoxxxxx",
                "timetable":[[“L”,"08:00:00", "23:59:59"], [“F”,"18:00:00", "20:00:00"]],
                "start_time": "2021-10-17T20:58:38Z"
                }

            ]
}

Auxiliar tables

For the decoding of the information of the different messages it is necessary to have some auxiliary tables with it.

Label Information

Returns the last information of the labels that may be affected.

Endpoint information endpoint:

  • Method: GET

  • URL: {baseUrl}/v1/taux_labels

  • Body:

All tags with their associated identifier are returned

  • Body:
[
    {
        "id": 1,
        "label": "0"
    },
    {
        "id": 2,
        "label": "ECO"
    },
    {
        "id": 3,
        "label": "C"
    },
    {
        "id": 4,
        "label": "B"
    }
]

Correspondence of INE codes with Municipalities

Returns the last INE code associated with each Municipality.

Information about endpoint:

  • Method: GET

  • URL: {baseUrl}/v1/taux_ine

  • Body:

All tags with their associated identifier are returned.

  • Body:
[
    {
        "id": 32003,
        "descrip": "A Arnoia"
    },
    {
        "id": 15007,
        "descrip": "A Baña"
    }

]