[go: up one dir, main page]

0% found this document useful (0 votes)
57 views5 pages

Booking API Documentation

The Booking API provides various endpoints for managing bookings, including retrieving, creating, updating, and deleting bookings. Key functionalities include generating authentication tokens and handling both successful and negative test cases. Each endpoint has specific request methods, expected responses, and test assertions to ensure proper functionality.

Uploaded by

ishfakeraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views5 pages

Booking API Documentation

The Booking API provides various endpoints for managing bookings, including retrieving, creating, updating, and deleting bookings. Key functionalities include generating authentication tokens and handling both successful and negative test cases. Each endpoint has specific request methods, expected responses, and test assertions to ensure proper functionality.

Uploaded by

ishfakeraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

API Documentation: Booking API

Base URL
{{test_url}}/booking

1. Get Booking ID

Method:
GET

Endpoint:
/booking

Test Assertions:
• Verify status code is 200.

Description:
This endpoint retrieves a list of bookings.

2. Create Booking

Method:
POST

Endpoint:
/booking

Request Body:

{
"firstname": "{{fname}}",
"lastname": "{{lname}}",
"totalprice": {{totalprice}},
"depositpaid": true,
"bookingdates": {
"checkin": "{{checkin}}",
"checkout": "{{checkout}}"
},
"additionalneeds": "{{additionalneeds}}"
}

Test Assertions:
• Verify status code is 200.

• Verify `firstname` and `lastname` match the expected values.

• Verify that the `totalprice` and booking dates match the expected values.

Description:
This endpoint creates a new booking with details like `firstname`, `lastname`, `totalprice`,
and booking dates.

3. Get Booking Details

Method:
GET

Endpoint:
/booking/{{b_id}}

Test Assertions:
• Verify status code is 200.

• Verify response body is valid JSON.

• Check that the `totalprice`, `firstname`, `lastname`, and booking dates match the expected
values.

• Response time should be less than 500ms.

Description:
This endpoint retrieves details for a specific booking by ID.

4. Token Generator

Method:
POST

Endpoint:
/auth
Request Body:

{
"username": "admin",
"password": "password123"
}

Test Assertions:
• Set the `b_token` environment variable with the token returned in the response.

Description:
This endpoint generates a token that can be used for authentication when performing
further actions (e.g., updating booking).

5. Update Booking Details

Method:
PUT

Endpoint:
/booking/{{b_id}}

Request Body:

{
"firstname": "Aisha",
"lastname": "ERaz",
"totalprice": 111,
"depositpaid": true,
"bookingdates": {
"checkin": "2019-01-01",
"checkout": "2024-01-01"
},
"additionalneeds": "Postman Knowledge"
}

Test Assertions:
• Verify status code is 200.
Description:
This endpoint updates an existing booking's details, such as the `firstname`, `lastname`,
`totalprice`, and additional needs.

6. Partial Update

Method:
PATCH

Endpoint:
/booking/{{b_id}}

Request Body:

{
"firstname": "Night",
"lastname": "Fury"
}

Test Assertions:
• Verify status code is 200.

Description:
This endpoint partially updates the booking details. You can modify specific fields like
`firstname` or `lastname`.

7. Delete Booking

Method:
DELETE

Endpoint:
/booking/{{b_id}}

Test Assertions:
• Verify status code is 201 (for successful deletion).

Description:
This endpoint deletes a booking.
8. Curl Command

Method:
POST

Endpoint:
/booking

Test Assertions:
• Ensure proper booking creation by checking the response.

Description:
This endpoint is a cURL-generated example of creating a booking.

Negative Test

Get Booking Details Invalid ID

Method:
GET

Endpoint:
/booking/7878

Test Assertions:
• Verify status code is 404 (Not Found).

Description:
This endpoint attempts to fetch a booking using an invalid ID.

You might also like