Creating Mock APIs to handle HTTP GET requests

The videos below demonstrate how to create mock API endpoints to handle HTTP GET requests

Tutorial 1a: Creating an API and calling it from the browser

In this video, we will be creating an HTTP GET API, save & publish it, and then call the API from the web browser. The API returns a list of 3 countries from the North America.

API Request
Request Path: /continent/north-america
HTTP Method: GET
API Response
Response Code: 200
Response Content-Type: application/json
Response Body:


















[
  {
      "country": "Canada",
      "country-alpha2-code": "CA",
      "captial": "Ottawa",
      "continent": "North America",
      "continent-code": "NA"
  },
  {
      "country": "United States of America",
      "country-alpha2-code": "US",
      "captial": "Washington, D.C.",
      "continent": "North America",
      "continent-code": "NA"
  },
  {
     "country": "Mexico",
     "country-alpha2-code": "MX",
     "captial": "Mexico City",
     "continent": "North America",
     "continent-code": "NA"
  }
]

 Watch Tutorial 1a

Tutorial 1b: Creating an API and calling it via cURL

We will be creating an HTTP GET API in this video, save and publish it, and then later we will launch a Linux Terminal and use cURL to call the newly created API and view the response returned by the newly created API

API Request
Request Path: /continent/north-america
HTTP Method: GET
API Response
Response Code: 200
Response Content-Type: application/json
Response Body:


















[
  {
      "country": "Canada",
      "country-alpha2-code": "CA",
      "captial": "Ottawa",
      "continent": "North America",
      "continent-code": "NA"
  },
  {
      "country": "United States of America",
      "country-alpha2-code": "US",
      "captial": "Washington, D.C.",
      "continent": "North America",
      "continent-code": "NA"
  },
  {
     "country": "Mexico",
     "country-alpha2-code": "MX",
     "captial": "Mexico City",
     "continent": "North America",
     "continent-code": "NA"
  }
]

 Watch Tutorial 1b