30 / May / 2016 by Keshav Kashyap 3 comments

What is API?

API stands for Application Programming Interface. It is a software-to-software interface, not a user interface. With APIs, applications converse with each other with no client learning or intervention.

API Workflow Example


What is API Testing?

API testing utilizes programming to send calls to the API and get the results. It regards the segment under the test as a black box. The primary objective of API testing is to confirm correct execution and failure treatment of all the APIs (if any) preceding its coordination into an application.


REST: Representational State Transfer

  • It’s an arrangement of functions on which the testers perform requests and receive responses. In REST, API interactions are made via HTTP protocol.
  • REST also permits communication between computers with each other over a network.
  • For sending and receiving messages, it involves using HTTP methods, and it does not require a strict message definition, unlike web services.
  • REST messages often accept the form either in the form of XML, or JavaScript Object Notation (JSON).

4 Commonly Used API Methods

  1. GET: It provides read-only access to a resource.
  2. POST: It is used to create or update a new resource.
  3. PUT: It is used to update or replace an existing resource or create a new resource.
  4. DELETE: It is used to remove a resource. 

REST API Inputs                                                                                                  




                                                                   Fig. GET Method Example


                                                                 Fig. POST Method Example


HTTP Response Codes

Some HTTP response codes, which are often used with REST

200 OK: – This code indicates that the request was made successful.

201 Created: – This code indicates that request was successful, a resource was created, and it validated the success of a PUT or POST request.

400 Bad Request: – This error code happens with POST and PUT requests when the data does not pass validation, or the passed data is in the wrong format.

404 Not Found: – This code indicates that the required resource could not be found or not available.

401 Unauthorized: – This error code indicates that you need to provide authentication before accessing the resource.

405 Method Not Allowed: – Method Not Allowed error indicates that the requested HTTP method is not supported for this resource.

409 Conflict: – This code indicates that the user created the same resource twice by which conflict occurs.

500 Internal Server Error: – Due to server-side issue, this error code occurs.


Common Types of Tests and Bugs in API Testing

  • Delayed in API Response time
  • To verify when API doesn’t return any response data.
  • Response Data is not structured
  • Difficulty in connecting and getting response from API
  • Output response should be checked by input request provided.
  • Verification of the API whether it triggers some other event or request another API
  • Verification of the API whether it is updating any data structure

Advantages of API Testing

  • It is time effective.
  • It is language independent.
  • It is quite helpful in testing Core Functionality.
  • It helps us to reduce the testing cost.
  • It helps us to reduce the risks.

Challenges of API Testing

  • Parameter Combination, Parameter Selection, and Call Sequencing are three major challenges in API testing.
  • Due to the absence of GUI, it is quite difficult to provide input values.
  • Parameters selection and categorization required must be known to the tester.



comments (3)

  1. Carlos Duque

    This is a great article, and it would add value if some products for API testing would have been mentioned. Some examples are Postman, Insomnia and Apibot.
    Regarding the three (3) challenges mentioned above, the one that stand out from the others is Apibot, it provides a GUI, that let you test, in my opinion, easily and fast. Although the three of them provides what is needed for testing in their original way.


Leave a Reply

Your email address will not be published. Required fields are marked *