Quick Start Guide For Mock Server

Suppose I am a frontend engineer and I need a REST API which backend team is going to implement. I am waiting for that API to get implemented by backend team. Instead of waiting, one can just create the API Mock and use it in their workflow. Lets walk through step by step, how API Mock can be created.

Suppose I want to create the following API Mock:

API Endpoint/contact/{{contactId}} 


Response HeadersContent-Type: application/json
Response Body
  "_id": "{{contactId}}",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "designation": "Chief Technical Officer",
  "organization": "Example.com",
  "country": "India",
  "aboutMe": "My name can be used as a placeholder name and I don't have any issue with that.",
  "twitterId": "fake.john.doe",
  "facebookId": "fake.john.doe",
  "githubId": "fake.john.doe",
  "createdOn": "2014-05-03T06:28:45.479Z"

Here contactId is a variable. Whatever is supplied in the URL for contactId variable should also be replaced in the response body.

We can create the above API Mock by following the steps below:

  1. First create an API Mock

  2. Setup response headers


  3. Setup response body


  4. Verify that the Mock is working now