pm.test(“API working”, function(){
pm.response.to.have.status("OK")
});
pm.test(“Filtered book details:-”, function(){
var jsonData = pm.response.json();
pm.expect(jsonData.type).to.eql("fiction");
})
In Console, Response body is like
[{“id”:1,“name”:“The Russian”,“type”:“fiction”,“available”:true},{“id”:3,“name”:“The Vanishing Half”,“type”:“fiction”,“available”:true},{“id”:4,“name”:“The Midnight Library”,“type”:“fiction”,“available”:true},{“id”:6,“name”:“Viscount Who Loved Me”,“type”:“fiction”,“available”:true}]