Create a JSON Data File - Example 3
GET https://restful-booker.herokuapp.com/booking/1
The Data file tool works best with response data in the form of an array
but it could be used with responses that are returned as a single object
.
In this secenario, you would need to add the names of the properties that you want to capture after the responseData
key.
let myResponseData = {
firstName: responseData.firstname,
lastName: responseData.lastname,
checkIn: responseData.bookingdates.checkin,
checkOut: responseData.bookingdates.checkout
};
The example above would create a data file which looks like this:
[
{
"firstName": "Jim",
"lastName": "Brown",
"checkIn": "2016-05-27",
"checkOut": "2017-10-13"
}
]
RESPONSES
status: OK
{"firstname":"Jim","lastname":"Brown","totalprice":276,"depositpaid":true,"bookingdates":{"checkin":"2016-05-27","checkout":"2017-10-13"},"additionalneeds":"Breakfast"}