Create a booking

POST /bookings

A booking is a temporary hold on a trip. It is not confirmed until the payment is processed.

Body Required

Body Required

Responses

  • Booking successful

    Hide response attributes Show response attributes object
    • id string(uuid)

      Unique identifier for the booking

    • trip_id string(uuid)

      Identifier of the booked trip

    • Name of the passenger

    • Indicates whether the passenger has a bicycle.

    • has_dog boolean

      Indicates whether the passenger has a dog.

    Hide response attributes Show response attributes object
    • id string(uuid)

      Unique identifier for the booking

    • trip_id string(uuid)

      Identifier of the booked trip

    • Name of the passenger

    • Indicates whether the passenger has a bicycle.

    • has_dog boolean

      Indicates whether the passenger has a dog.

  • Bad Request

    Hide headers attribute Show headers attribute
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

  • Unauthorized

    Hide headers attribute Show headers attribute
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

  • Not Found

    Hide headers attribute Show headers attribute
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

  • Conflict

    Hide headers attribute Show headers attribute
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

  • Too Many Requests

    Hide headers attributes Show headers attributes
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    • The Retry-After header indicates how long the user agent should wait before making a follow-up request. The value is in seconds and can be an integer or a date in the future. If the value is an integer, it indicates the number of seconds to wait. If the value is a date, it indicates the time at which the user agent should make a follow-up request.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

  • Internal Server Error

    Hide headers attribute Show headers attribute
    • The RateLimit header communicates quota policies. It contains a limit to convey the expiring limit, remaining to convey the remaining quota units, and reset to convey the time window reset time.

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

    Hide response attributes Show response attributes object
    • type string

      A URI reference that identifies the problem type

    • title string

      A short, human-readable summary of the problem type

    • detail string

      A human-readable explanation specific to this occurrence of the problem

    • instance string

      A URI reference that identifies the specific occurrence of the problem

    • status integer

      The HTTP status code

POST /bookings
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 examples
{
  "trip_id": "4f4e4e1-c824-4d63-b37a-d8d698862f1d",
  "passenger_name": "John Doe",
  "has_bicycle": true,
  "has_dog": true
}
Request examples
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <trip-id>4f4e4e1-c824-4d63-b37a-d8d698862f1d</trip-id>
  <passenger-name>John Doe</passenger-name>
  <has-bicycle type="boolean">true</has-bicycle>
  <has-dog type="boolean">true</has-dog>
</root>
Response examples (201)
{
  "id": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
  "links": {
    "self": "https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e"
  },
  "has_dog": true,
  "trip_id": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
  "has_bicycle": true,
  "passenger_name": "John Doe"
}
Response examples (201)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <id>3f3e3e1-c824-4d63-b37a-d8d698862f1d</id>
  <trip-id>4f4e4e1-c824-4d63-b37a-d8d698862f1d</trip-id>
  <passenger-name>John Doe</passenger-name>
  <has-bicycle type="boolean">true</has-bicycle>
  <has-dog type="boolean">true</has-dog>
  <links>
    <self>https://example.com</self>
  </links>
</root>
Response examples (400)
{
  "type": "https://example.com/errors/bad-request",
  "title": "Bad Request",
  "detail": "The request is invalid or missing required parameters.",
  "status": 400
}
Response examples (400)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/bad-request</type>
  <title>Bad Request</title>
  <detail>The request is invalid or missing required parameters.</detail>
  <status type="integer">400</status>
</root>
Response examples (401)
{
  "type": "https://example.com/errors/unauthorized",
  "title": "Unauthorized",
  "detail": "You do not have the necessary permissions.",
  "status": 401
}
Response examples (401)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/unauthorized</type>
  <title>Unauthorized</title>
  <detail>You do not have the necessary permissions.</detail>
  <status type="integer">401</status>
</root>
Response examples (404)
{
  "type": "https://example.com/errors/not-found",
  "title": "Not Found",
  "detail": "The requested resource was not found.",
  "status": 404
}
Response examples (404)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/not-found</type>
  <title>Not Found</title>
  <detail>The requested resource was not found.</detail>
  <status type="integer">404</status>
</root>
Response examples (409)
{
  "type": "https://example.com/errors/conflict",
  "title": "Conflict",
  "detail": "There is a conflict with an existing resource.",
  "status": 409
}
Response examples (409)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/conflict</type>
  <title>Conflict</title>
  <detail>There is a conflict with an existing resource.</detail>
  <status type="integer">409</status>
</root>
Response examples (429)
{
  "type": "https://example.com/errors/too-many-requests",
  "title": "Too Many Requests",
  "detail": "You have exceeded the rate limit.",
  "status": 429
}
Response examples (429)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/too-many-requests</type>
  <title>Too Many Requests</title>
  <detail>You have exceeded the rate limit.</detail>
  <status type="integer">429</status>
</root>
Response examples (500)
{
  "type": "https://example.com/errors/internal-server-error",
  "title": "Internal Server Error",
  "detail": "An unexpected error occurred.",
  "status": 500
}
Response examples (500)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <type>https://example.com/errors/internal-server-error</type>
  <title>Internal Server Error</title>
  <detail>An unexpected error occurred.</detail>
  <status type="integer">500</status>
</root>