How to Manually test REST API’s?
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. It can be executed by composing capacity brings in the system.
API Workflow Example
What is API Testing?
API testing utilizes programming to send calls to the API and get the yield. It testing regards the segment under test as a black box. The objective of API testing is to confirm right execution and blunder treatment of the part preceding its coordination into an application.
What are REST API?
REST: Representational State Transfer.
- It’s an arrangement of functions on which the testers performs 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.
Some Commonly Used API Methods:-
- GET: – It provides read-only access to a resource.
- POST: – It is used to create or update a new resource.
- PUT: – It is used to update or replace an existing resource or create a new resource.
- DELETE: – It is used to remove a resource.
REST API Inputs:-
|Method – GET||Method – POST||Method – PUT||Method – DELETE|
|Input JSON||Input JSON||Input JSON|
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 and 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 creates 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 on the basis of provided input request.
- 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 absence of GUI it is quite difficult to provide input values.
- Parameters selection and categorization required must be known to the tester.