Welcome to Restful-Booker

An API playground created by Mark Winteringham for those wanting to learn more about API testing and tools


@2bittester | Website | Code

Welcome to Restful-booker an API that you can use to learn more about API Testing or try out API testing tools against. Restful-booker is a Create Read Update Delete Web API that comes with authentication features and loaded with a bunch of bugs for you to explore. The API comes pre-loaded with 10 records for you to work with and resets itself every 10 minutes back to that default state.

Whilst the bugs you find are intentional, the API shouldn't go down so if you come across any requests that cause the API to go down, let me know via Twitter.

API Details

GET /ping

Usage

GET /ping

Response

200 OK - If application is up

GET /booking

GET /booking
GET /booking?firstname=sally&lastname=brown
GET /booking?checkin=2014-03-13&checkout=2014-05-21

Parameters

  • firstname - String - The firstname of the user
  • lastname - String - The lastname of the user
  • checkin - Date(CCYY-MM-DD) - The day in which person(s) checks in
  • checkout - Date(CCYY-MM-DD) - The day in which person(s) checks out

Response

[
  {
    "bookingid": 1
  },
  {
    "bookingid": 2
  },
  {
    "bookingid": 3
  },
  {
    "bookingid": 4
  }
]

GET /booking/{id}

GET /booking/1

Parameters

  • id - String - The unique identifier of the booking

Response

Accept: application/json
{
    "firstname": "Sally",
    "lastname": "Brown",
    "totalprice": 111,
    "depositpaid": true,
    "bookingdates": {
        "checkin": "2013-02-23",
        "checkout": "2014-10-23"
    },
    "additionalneeds": "Breakfast"
}
Accept: application/xml
<booking>
    <firstname>Sally</firstname>
    <lastname>Brown</lastname>
    <totalprice>111</totalprice>
    <depositpaid>true</depositpaid>
    <bookingdates>
        <checkin>2013-02-23</checkin>
        <checkout>2014-10-23</checkout>
    </bookingdates>
    <additionalneeds>Breakfast</additionalneeds>
</booking>

POST /booking

POST /booking

Payload

Content-Type: text/xml
<booking>
    <firstname>Sally</firstname>
    <lastname>Brown</lastname>
    <totalprice>111</totalprice>
    <depositpaid>true</depositpaid>
    <additionalneeds>Breakfast</additionalneeds>
    <bookingdates>
        <checkin>2013/02/23</checkin>
        <checkout>2014/10/23</checkout>
    </bookingdates>
</booking>
Content-Type: application/json
{
  "firstname" : "Sally",
	"lastname" : "Brown",
	"totalprice" : 111,
	"depositpaid" : true,
	"additionalneeds" : "Breakfast",
	"bookingdates" : {
		"checkin" : "2013-02-23",
		"checkout" : "2014-10-23"
	}
}

Response

Accept: application/json
{
    "booking": {
        "firstname": "Sally",
        "lastname": "Brown",
        "totalprice": 111,
        "depositpaid": true,
        "additionalneeds": "Breakfast",
        "bookingdates": {
            "checkin": "2013-02-23",
            "checkout": "2014-10-23"
        }
    }
}
Accept: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<created-booking>
    <booking>
        <firstname>Sally</firstname>
        <lastname>Brown</lastname>
        <totalprice>111</totalprice>
        <depositpaid>true</depositpaid>
        <additionalneeds>Breakfast</additionalneeds>
        <bookingdates>
            <checkin>2013-02-23</checkin>
            <checkout>2014-10-23</checkout>
        </bookingdates>
    </booking>
</created-booking>

POST /auth

POST /auth

Payload

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

Response

VHgTAuGPxvMsH1p

PUT /booking/{id}

PUT /booking/1

Authentication requirements

  • Cookie: token={token received from /auth}

Parameters

  • id - String - The unique identifier of the booking

Payload

Content-Type: text/xml
<booking>
    <firstname>Sally</firstname>
    <lastname>Brown</lastname>
    <totalprice>111</totalprice>
    <depositpaid>true</depositpaid>
    <additionalneeds>Breakfast</additionalneeds>
    <bookingdates>
        <checkin>2013/02/23</checkin>
        <checkout>2014/10/23</checkout>
    </bookingdates>
</booking>
Content-Type: application/json
{
  "firstname" : "Sally",
	"lastname" : "Brown",
	"totalprice" : 111,
	"depositpaid" : true,
	"additionalneeds" : "Breakfast",
	"bookingdates" : {
		"checkin" : "2013-02-23",
		"checkout" : "2014-10-23"
	}
}

Response

Accept: application/json
{
    "id": "1",
    "firstname": "Sally",
    "lastname": "Brown",
    "totalprice": 111,
    "depositpaid": true,
    "additionalneeds": "Breakfast",
    "bookingdates": {
        "checkin": "2013-02-23",
        "checkout": "2014-10-23"
    }
}
Accept: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<booking>
    <id>1</id>
    <firstname>Sally</firstname>
    <lastname>Brown</lastname>
    <totalprice>111</totalprice>
    <depositpaid>true</depositpaid>
    <additionalneeds>Breakfast</additionalneeds>
    <bookingdates>
        <checkin>2013-02-23</checkin>
        <checkout>2014-10-23</checkout>
    </bookingdates>
</booking>

DELETE /booking/{id}

DELETE /booking/1

Authentication requirements

  • Cookie: token={token received from /auth}

Parameters

  • id - String - The unique identifier of the booking

Response

204 - On successful delete