Create Mock APIs with HTTP Headers

The video tutorial below demonstrates how to create an API endpoint that handles HTTP Requests with Headers. Headers can be defined for endpoints that respond to GET, POST, PUT and DELETE requests.

 Watch Video
API Request
Request Path: /product/add
HTTP Method: GET

Request Headers
Headers Count: 2

Header Name : authorization
Header Value: Bearer token1

Header Name: app-id
Header Value: app-88
HTTP Request Body
                    ​{
                       "name": "tv",
                       "description": "65inch - 4K",
                       "manufacturer": "xyz",
                       "model": "X12345678990",
                       "price": "$650.00",
                       "smart": true
                    }
API Response
Response Code: 201
Response Content-Type: application/json
Response Body:
               {
                  "message":"new item added successfully",
                  "success": true
               }
Alternate Response # 1
Response Code: 201
Response Content-Type: application/json
Response Body:
                   {
                      "message":"new item added successfully",
                      "success": true
                   }
Alternate Response # 2
Response Code: 403
Response Content-Type: application/json
Response Body:
               {
                   "message": "cannot add new item, permission denied",
                   "success": false
               }
Alternate Response # 3
Response Code: 422
Response Content-Type: application/json
Response Body:
              ​{
                  "message": "invalid/unknown fields were found in the request body, cannot process the request",
                  "success": false
              }
Alternate Response # 4
Response Code: 500
Response Content-Type: text/plain
Response Body:
                Internal Server Error - Contact API Team if the problem persists