Link Search Menu Expand Document

Booking a leg

/bookings

With this endpoint the user can book the planned trip by submitting the legid and the userId.

POST https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings

Request body parameters

Field Content Note
id “7b0846ab-8192-4c1b-8b30-454382074e9e” Required. The id of the leg that should be booked.
customer {“id”: “34f92e7e-88b8-11ec-a8a3-0242ac120004”, “firstName”: “Tomp4”, “lastName”: “Test”, “email”: “tomp4_test@mailinator.com”} Required. Customer object which includes info about the user.
curl --location --request POST 'https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings' \
-H 'x-api-key: API_KEY' \
-H 'api-version: 1.3.0' \
-H 'maas-id: 1324A-DFB3482-32ACD' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
--data-raw '{
    "id": "8950aa4d-c609-4a8c-bf2d-61a58c140fa9",
    "customer": {
        "id": "34f92e7e-88b8-11ec-a8a3-0242ac120004",
        "firstName": "Tomp4",
        "lastName": "Test",
        "email": "tomp4_test@mailinator.com"
    }
}
'

Click to expand JSON data response
{
    "id": "8950aa4d-c609-4a8c-bf2d-61a58c140fa9",
    "state": "PENDING"
}

Error Responses

When booking a leg you may encounter a 400, 404 error response.

400 Bad Request Error

400 means that the validation of the request body has failed. For this endpoint we validate the request body for the presence of the (leg) id and the (customer)id.

Click to expand JSON data response
{
    "message": "body should have required property 'id'",
    "errorCode": 3001,
    "statusCode": 400,
    "name": "BadRequestError"
}

404 Not Found Error

404 means that no legs could be found with the submitted id.

Click to expand JSON data response
{
    "message": "No leg was found with id: 8950aa4d-c609-4a8c-bf2d-61a58c140fa9.",
    "errorCode": 3001,
    "error": "NotFoundError",
    "statusCode": 404
}

ℹ Legs are only stored for a limited (10 minutes) time before booking.

Get a booking

/bookings/:id

With this endpoint the customers can get information about their existing bookings.

POST https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings/:id

Path parameters

Parameter Type Description
id String The id of the booking (identical to the legId)
curl -L -X GET 'https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings/8950aa4d-c609-4a8c-bf2d-61a58c140fa9' \
-H 'x-api-key: API_KEY' \
-H 'api-version: 1.3.0' \
-H 'maas-id: 1324A-DFB3482-32ACD' \
-H 'Accept-Language: en' 
Click to expand JSON data response
{
    "state": "CONFIRMED",
    "legs": [
        {
            "from": {
                "coordinates": {
                    "lat": 51.520224,
                    "lng": -0.128995
                }
            },
            "id": "8950aa4d-c609-4a8c-bf2d-61a58c140fa9",
            "asset": {
                "overriddenProperties": {
                    "meta": {
                        "vehicleCode": 123456
                    }
                },
                "id": "9da838095e3598d478f579d5f86fe1c73664653aa8cc02f75bbe2077569bfd0f",
                "licensePlate": "ABC123"
            },
            "assetType": {
                "id": "tier-emoped",
                "assetClass": "MOPED",
                "assetSubClass": "emoped",
                "sharedProperties": {
                    "propulsion": "ELECTRIC",
                    "fuel": "ELECTRIC"
                }
            }
        }
    ],
    "extraData": {},
    "id": "8950aa4d-c609-4a8c-bf2d-61a58c140fa9",
    "customer": {
        "id": "34f92e7e-88b8-11ec-a8a3-0242ac120004"
    }
}

Error Responses

When booking a leg you may encounter a 404 error response.

404 Not Found Error

404 means that no booking could be found with the submitted id.

Click to expand JSON data response
{
    "message": "No booking was found with id: 8950aa4d-c609-4a8c-bf2d-61a58c140fa.",
    "errorCode": 3203,
    "error": "NotFoundError",
    "statusCode": 404
}

Confirming, Canceling a booking

/bookings/:id/events

With this endpoint the customers can confirm, cancel their existing bookings.

POST https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings/:id/events

Path parameters

Parameter Type Description
id String The id of the booking (identical to the legId)

Request body parameters

Field Content Note
operation COMMIT, CANCEL, DENY, EXPIRE Required. The operation that should be performed on the booking.
curl -L -X POST 'https://platform.tier-services.io/data-sharing/tier_utrecht/tomp/bookings/8950aa4d-c609-4a8c-bf2d-61a58c140fa9/events' \
-H 'x-api-key: API_KEY' \
-H 'api-version: 1.3.0' \
-H 'maas-id: 1324A-DFB3482-32ACD' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
--data-raw '{
    "operation": "COMMIT"
}'

Click to expand JSON data response
{
    "id": "8950aa4d-c609-4a8c-bf2d-61a58c140fa9",
    "state": "CONFIRMED"
}

Error Responses

When booking a leg you may encounter a 400, 404 error response.

400 Bad Request Error

400 means that the validation of the request body has failed. For this endpoint we validate the request body for operation.

Click to expand JSON data response
{
    "message": "body.operation should be equal to one of the allowed values",
    "errorCode": 3001,
    "statusCode": 400,
    "name": "BadRequestError"
}

404 Not Found Error

404 means that no booking could be found with the submitted id.

Click to expand JSON data response
{
    "message": "No booking was found with id: 8950aa4d-c609-4a8c-bf2d-61a58c140fa.",
    "errorCode": 3203,
    "error": "NotFoundError",
    "statusCode": 404
}