Demonstrating Drag and Drop of get response Block into Canvas
5) Let’s give it a dry run and see what we are receiving in the response after the run.
In the above screenshot, we can see the request we have sent to the REST API with the request headers that have been passed.
In the above screenshot, we can observe how Scriptworks is reporting the REST API response.
6) Drag comment to let others know what we are going to do now. And for that, follow Step 3 Above.
Search → Comment → Drag and Drop to Canvas
7) Now, to validate the response, or we can say in technical terms, i.e., to Assert the API response received by Scriptworks. Drag the Assert block multiple times to the number of Assertions you want, put it in Canvas, and fill it with information you wish to assert from the Rest API response.
Search → Assert → Drag and Drop to Canvas
We have added the Assert Blocks. Now, what do we have to Assert?
We have to Assert the status code and status message from the API Response. The further Response properties are available alongside the Response body. So search for the response in the search box and pick the response body block and drag it into the canvas, selecting the property we wish to validate.
Search → Response → Drag and Drop Response Body into Canvas
8) Now, the final thing is Test Run. Make sure you have followed the prerequisite mentioned above before the Test Run. Make sure you can see Green Symbol before clicking on the play icon.
That’s how we can validate a REST API request and its response code and status message in Scriptworks.