{"info":{"_postman_id":"bcbc5346-45bc-4ac4-8c74-43be36857d41","name":"Restful Booker","description":"<html><head></head><body><h2 id=\"overview\">Overview</h2>\n<p>The Restful Booker API is a sample API based on hotel bookings. The API contains endpoints to demonstrate CRUD operations. The source code can be obtained from <a href=\"https://github.com/mwinteringham/restful-booker\">https://github.com/mwinteringham/restful-booker</a></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"4805376","collectionId":"bcbc5346-45bc-4ac4-8c74-43be36857d41","publishedId":"SVfWN6F1","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2019-09-06T19:02:45.000Z"},"item":[{"name":"Bookings","item":[{"name":"Get Bookings","event":[{"listen":"test","script":{"id":"e2a9a7a0-e79d-4b0a-8036-4f043c2ed658","exec":[""],"type":"text/javascript"}}],"id":"f842fb91-5b7b-441a-a62b-b30424cbedc9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{url}}/booking","description":"<p>Get a list of all bookings</p>\n","urlObject":{"path":["booking"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f842fb91-5b7b-441a-a62b-b30424cbedc9"},{"name":"Create new Booking","event":[{"listen":"test","script":{"id":"ab85e255-2d15-4deb-9417-8776ab9609da","exec":["var jsonData = pm.response.json();","","pm.test(\"Check firstname of new Booking\", function () {","    pm.expect(jsonData.firstname).to.eql(\"Sally\");","});","",""],"type":"text/javascript"}}],"id":"ca4e7e5b-5e4f-42e1-95df-6482f66aef94","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"firstname\" : \"Sally\",\r\n  \"lastname\" : \"Brown\",\r\n  \"totalprice\" : 111,\r\n  \"depositpaid\" : true,\r\n  \"additionalneeds\" : \"Breakfast\",\r\n  \"bookingdates\" : {\r\n    \"checkin\" : \"2013-02-23\",\r\n    \"checkout\" : \"2014-10-23\"\r\n  }\r\n}"},"url":"{{url}}/booking","urlObject":{"path":["booking"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ca4e7e5b-5e4f-42e1-95df-6482f66aef94"},{"name":"Update Booking (partial)","event":[{"listen":"test","script":{"id":"78e18df7-62b7-46d9-a793-6e9640855498","exec":["","","","",""],"type":"text/javascript"}}],"id":"ba15d29d-cb6f-4de1-b8ff-1c3abfa6d3ce","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"key":"Accept","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"firstname\" : \"James\",\r\n    \"lastname\" : \"Brown\",\r\n    \"totalprice\" : 111,\r\n    \"depositpaid\" : true,\r\n    \"bookingdates\" : {\r\n        \"checkin\" : \"2018-01-01\",\r\n        \"checkout\" : \"2019-01-01\"\r\n    },\r\n    \"additionalneeds\" : \"Breakfast\"\r\n}"},"url":"{{url}}/booking/{{bookingID}}","urlObject":{"path":["booking","{{bookingID}}"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ba15d29d-cb6f-4de1-b8ff-1c3abfa6d3ce"},{"name":"Get Booking by ID","event":[{"listen":"test","script":{"id":"21ee0aa2-372c-4dbf-9317-ae7ad6ef4d8c","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","",""],"type":"text/javascript"}}],"id":"d1c07d48-4bce-40d4-9da6-78c4cc05ed6c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{url}}/booking/{{bookingID}}","urlObject":{"path":["booking","{{bookingID}}"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d1c07d48-4bce-40d4-9da6-78c4cc05ed6c"},{"name":"Delete Booking","event":[{"listen":"test","script":{"id":"565047c0-2425-409f-9527-a706b820ee9d","exec":["var url = pm.environment.get(\"url\") + \"/booking/\" +  pm.environment.get(\"bookingID\");","","const getRequest = {","        url: url,","        method: 'GET'","};","","pm.sendRequest(getRequest, function (err, res) {","    if (err) { ","        console.log(err);","    }","    ","    console.log(res);","    ","    pm.test('Response should be Not Found', function () {","        pm.expect(res.status).to.include(\"Not Found\");","    });","    ","    pm.test(\"Response code 404\", function() {","        pm.expect(res.code).to.equal(404);","    })","});",""],"type":"text/javascript"}}],"id":"c7d5f18d-f1cb-4227-a0ea-eb32e50ca147","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"DELETE","header":[{"key":"Cookie","value":"token={{authToken}}","type":"text"}],"body":{"mode":"raw","raw":""},"url":"{{url}}/booking/{{bookingID}}","urlObject":{"path":["booking","{{bookingID}}"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c7d5f18d-f1cb-4227-a0ea-eb32e50ca147"}],"id":"9121ca27-67df-4117-9149-3f78df3c87a2","description":"<p>All bookings requests </p>\n","_postman_id":"9121ca27-67df-4117-9149-3f78df3c87a2"},{"name":"Auth","item":[{"name":"Get Auth Token","event":[{"listen":"test","script":{"id":"4ebb965a-e091-4af6-9af8-02463a1303e9","exec":["/*","var authSchema = {","  \"properties\": {","    \"token\": {","        \"description\": \"The auth token returned\",","        \"type\": \"string\",","    }","  }","};","","var response = JSON.parse(responseBody);","","pm.test('Schema is valid', function() {","  pm.expect(tv4.validate(response, authSchema)).to.be.true;","});","*/","",""],"type":"text/javascript"}},{"listen":"prerequest","script":{"id":"85908a6b-585a-4877-a4c6-a0fda0e828cf","exec":["/*","var password = pm.environment.get(\"variable_key\");","console.log(\"password is \" + password);","if(password === undefined) {","    console.log(\"Setting password to password123\");","    pm.environment.set(\"password\", \"password123\");","}","*/"],"type":"text/javascript"}}],"id":"f1e0b284-d540-44ef-8144-90b051c66df8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"admin\",\r\n    \"password\": \"{{password}}\"\r\n}"},"url":"{{url}}/auth","description":"<p>Get auth token</p>\n","urlObject":{"path":["auth"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f1e0b284-d540-44ef-8144-90b051c66df8"}],"id":"efad5358-bad5-446c-a595-b9fbfa6ce822","_postman_id":"efad5358-bad5-446c-a595-b9fbfa6ce822","description":""}],"event":[{"listen":"prerequest","script":{"id":"de0423f3-d3bf-463b-9f55-1b740214ad26","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"d95ca0a9-9d06-46e0-bad6-cd7589cfcdb2","type":"text/javascript","exec":[""]}}]}