How To Create a Local API server

In this post, we will learn How to create a local API server, How to install and start JSON server.

Install JSON Server

Before start JSON server first we need to download and install Node.js.

Step 1: For download go to –

See in below image,  download it base on your Operating system.


download nodeJS


Step 2: After download node.js you can install it by double click on this.

Step 3: Once installed it, you can perform below command in command prompt. This command will install JSON server.

npm install -g json-server

Step 4: Now time to start the JSON server using below command.

json-server --watch db.json

JSON server start

Resources –


Step 5: Using above URL, we can check posts, comments and profile in browser also.

It will show like below.

Above details are coming from db.json file.

You can check db.json file reside in your C drive –> users folder.


Step 6: We can edit above db.json file and we can enter own data in this file. You can see below I have opened this in notepad++ and enter own data.

We can see also this data on URL – http://localhost:3000/glossary

Now we will see how we can use this above endpoint and json data with GET, POST, PUT and DELETE methods using RESTAssured.

Perform GET Request on Local Host API Server

package Demo;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static io.restassured.RestAssured.*;
import org.testng.annotations.Test;

import io.restassured.RestAssured;
import io.restassured.http.ContentType;

public class Test02_GET {

    void test02() {
        baseURI = "http://localhost:3000/";
        .then().statusCode(200).body("GlossDiv.GlossList.GlossEntry.ID", equalTo("SGML"));






I hope this tutorial will be helpful for you to understand ‘How To Create a Local API server’ for API Testing.


Must Read-

API Testing – Part-1

API Testing- Part-2


Leave a Comment