Create a booking
POST
/bookings
A booking is a temporary hold on a trip. It is not confirmed until the payment is processed.
application/json
Body Required
-
trip_id string(uuid)
Identifier of the booked trip
-
passenger_name string
Name of the passenger
-
has_bicycle boolean
Indicates whether the passenger has a bicycle.
-
has_dog boolean
Indicates whether the passenger has a dog.
Body Required
-
trip_id string(uuid)
Identifier of the booked trip
-
passenger_name string
Name of the passenger
-
has_bicycle boolean
Indicates whether the passenger has a bicycle.
-
has_dog boolean
Indicates whether the passenger has a dog.
Responses
-
• 201application/json
Booking successful
-
• 400application/problem+json
Bad Request
-
• 401application/problem+json
Unauthorized
-
• 404application/problem+json
Not Found
-
• 409application/problem+json
Conflict
-
• 429application/problem+json
Too Many Requests
-
• 500application/problem+json
Internal Server Error
POST /bookings
cURL (application/json)
curl \
-X POST https://api.example.com/bookings \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"trip_id":"4f4e4e1-c824-4d63-b37a-d8d698862f1d","passenger_name":"John Doe","has_bicycle":true,"has_dog":true}'
curl \
-X POST https://api.example.com/bookings \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/xml"
Request example
{
"trip_id": "4f4e4e1-c824-4d63-b37a-d8d698862f1d",
"passenger_name": "John Doe",
"has_bicycle": true,
"has_dog": true
}
Response examples (201)
{
"id": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
"trip_id": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
"passenger_name": "John Doe",
"has_bicycle": true,
"has_dog": true,
"links": {
"self": "https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e"
}
}
Response examples (400)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "The request is invalid or missing required parameters."
}
Response examples (400)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "The request is invalid or missing required parameters."
}
Response examples (401)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "You do not have the necessary permissions."
}
Response examples (401)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "You do not have the necessary permissions."
}
Response examples (404)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/not-found",
"title": "Not Found",
"status": 404,
"detail": "The requested resource was not found."
}
Response examples (404)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/not-found",
"title": "Not Found",
"status": 404,
"detail": "The requested resource was not found."
}
Response examples (409)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "There is a conflict with an existing resource."
}
Response examples (409)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "There is a conflict with an existing resource."
}
Response examples (429)
# Headers
RateLimit: limit=10, remaining=0, reset=10
Retry-After: 120
# Payload
{
"type": "https://example.com/errors/too-many-requests",
"title": "Too Many Requests",
"status": 429,
"detail": "You have exceeded the rate limit."
}
Response examples (429)
# Headers
RateLimit: limit=10, remaining=0, reset=10
Retry-After: 120
# Payload
{
"type": "https://example.com/errors/too-many-requests",
"title": "Too Many Requests",
"status": 429,
"detail": "You have exceeded the rate limit."
}
Response examples (500)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/internal-server-error",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred."
}
Response examples (500)
# Headers
RateLimit: limit=10, remaining=0, reset=10
# Payload
{
"type": "https://example.com/errors/internal-server-error",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred."
}