Scriptworks Logo

REST - POST Request 201

13 May 2021

This Article covers HTTP method POST, requests made to a REST API to create resources at the URI end, and validation of the response through Scriptworks.


In this article, we will perform an API Request and generate the response code 201 and will validate it through Scriptworks - A Visual Programming/low Code Automation tool.

First, I will demonstrate the exercise we need to perform, followed by practically demonstrating the Automation through Drag and Drop of the relevant Blocks in Scriptworks for achieving it.

HTTP Method Discussed in this Article:-

POST:- HTTP Method POST is used to create resources at the URI end. Generally, it is used to create subordinate resources. 

HTTP Status Code Discussed in this Article:- 

201:- HTTP Status code 200 belongs to the Success Category. It shows that the request has been taken and a new resource has been created at the URI endpoint.

Note – Here, We are using to practice the REST API’s queries and response validation.


1) Open your preferred browser chrome, firefox, etc.

Navigate to any browser

2) Navigate to

3) Perform Post Request and validate the response code 201

Practical Demonstration

Following are the Steps to Perform the above Exercise, including validation using Scriptworks Visual Programming/Low code in ‘Scriptworks’ IDE:-

Pre-requisite: Users should be able to login to Scriptworks via their Credentials, and their Scriptworks Client should be up and running. 

To know more about Scriptworks Client and Selenium Standalone Server, please follow this Article.

1) Open Scriptworks on your system with your credentials and open the project where you want to perform the Automated validations on the REST API response.

Open Project MyTest

2) Now click on the Block symbol present on the left side panel and then click on getting started 

BlockSymbol → Getting Started → API Test

As we know, we are going to initiate an API test. So Drag and Drop “API Test” onto the Canvas After clicking on the Getting Started link.

Getting Started link should be clicked

API Test to Get Started

Putting API Test Block into the Canvas

3) Now, we will use the comment block to let others know what we will perform. For that, we are going to click on the search text box and write a comment and hit return.

Search → Comment → Drag and Drop to Canvas

put your cursor in search box

Put Comment Block into the Canvas

Fill the comments and put it into canvas

4) Now, we will drag and drop some basic blocks required for the REST API call to request the resource. 

For the REST API Request, we need four basic things from Scriptworks.

i) REST Call Block

ii) Method Block

iii) URI Block

iv) Response Block 

We have searched for the comment block in step 3 similarly we have to do so the other required blocks and drag and drop them onto the canvas.

  1. Search → REST Call → Drag and Drop to Canvas
  2. Search → Method → Drag and Drop to Canvas
  3. Search → URI → Drag and Drop to Canvas
  4. Search → Body → Drag and Drop to Canvas
  5. Search → get Response → Drag and Drop to Canvas

Demonstrating Drag and Drop of Rest call Block to Canvas

search for rest call block in search box

Put Rest Call Block inside the canvas

Demonstrating Drag and Drop of Method Block into Canvas 

search for method block into the search box

By default, we would have GET as the HTTP method. Change it to POST by clicking the drop-down present in the method block.

Select HTTP Verb POST from the Drop Down

POST Method is formed

Demonstrating Drag and Drop of URI Block into Canvas

Search for URI Block from Left Hand Side Panel

In URI Block Enter “

Enter URL into the URI Block

Demonstrating Drag and Drop of Add Body Block into Canvas

search Add Body Block from left panel

Put Add Body block into the Canvas

Now enter the Payload inside the add body block.

Payload needs to be entered in add body block


By default Scriptworks provides a single line text edit field which is adequate for entering or editing smaller values. A recently added feature is the multiline block that can be expanded to display and edit much larger values e.g. a request body, as follows: 

Click on Block symbol → Click on Input Values Link → Choose Multiline block → Drag and drop to Canvas.

put multiline block into the canvas

expanded multiline block

Demonstrating Drag and Drop of get response Block into Canvas

search for get Response from left side panel

put get response block inside the canvas

5) Let’s give it a dry run and see what we are receiving in the response after the run.

Request results with request headers

In the above screenshot, we can see what request we have sent to the REST API with the kind of request headers that have been passed.

response results with response headers

In the above screenshot, we can see how Scriptworks is logging the REST API response.

6) Drag in a 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

put comment for validate response inside canvas

7) Now, to validate the response received (in Scriptworks terms - to assert). Drag the Assert block multiple times onto the canvas for the number of Assertions required and populate them with the information you wish to validate from the REST API response.

Search → Assert → Drag and Drop to Canvas

We have added the Assert Block. Now, what do we have to Assert? 

We have to Assert the status code and message from the API Response. To get these properties of the Response we use the response properties block. So search for response in the search box and pick the response properties block and drag it into the canvas.

Search → Response → Drag and Drop Response Body into Canvas

search response from left hand side

pull multiple assert block into the canvas

select status code from the dropdown

completed blocks inside the v

8) Now, the final thing is a Test Run. Make sure you have followed the prerequisite mentioned above before the Test Run. Make sure you can see the Green Symbol before clicking on the play icon. 

highlighted play button and client

Finally Pass

That’s how we can validate a REST API with the response code and status message in Scriptworks.

Scriptworks logo
© Copyright 2024 | Scriptworks is part of Odin Technology Ltd, a company registered in England no. 03735083