API Testing

API facilitates the communication and exchange of data among different systems and is written and developed in advanced for modular software development approach. It is an application or system that can be used to implement as a programming interface which is written using functions or sub-routines and can be used by other software.

API Testing mostly focuses on the business logic layer (as defined in the diagram) of software development architecture.

API testing does not have any connection with the look and feel (or UI, i.e., User Interface) of the software product. As an alternative of using standard input devices (like a keyboard) or output devices (like a monitor), API testing uses software for sending calls to your API that you'll use during API test to fetch output and eventually document the response of your product.

Below is an example of an API test where JSON input is mentioned which is used to call the Login API.

Request Body (JSON):
{
  "Username": "[email protected]",
  "Password": "securepassword"
}

While testing the API, the tester examines the input and expected output according to the technical document.

Sample Response - Success:
{
  "ResponseCode": 200,
  "Message": "Success",
  "Data": {
    "UserGUID": "46cba3f2-3cd0-4bca-19d6-208753741c5",
    "FirstName": "Dev",
    "LastName": "",
    "SessionKey": "3f67f981-387a-0850-1e21-42ee6bc4db08"
  }
}
Sample Response - Error:
{
  "ResponseCode": 500,
  "Message": "Invalid login credentials",
  "Data": []
}

Courses
Subscribe Updates via Email

Join 49,000+ W3schools lovers and get all the latest tutorials, programs, algorithms in your inbox.