1. Q: How do you verify that the API response status code is 200 OK?
A: You can use tools like Postman, REST Assured, or curl to make a request and check the response status code. A 200 OK means the request was successful.
2. Q: How can you verify that the API response is in the expected format like JSON or XML?
A: Check the Content-Type header in the response. For JSON, it should be application/json; for XML, application/xml.
3. Q: How do you check if the API response contains all the expected fields?
A: Compare the actual response fields with the expected schema using tools like Postman, JSON Schema Validator, or automated scripts.
4. Q: How do you verify that each field contains the correct data?
A: Check field values against the expected values using assertions in test scripts or by comparing with a known valid dataset.
5. Q: How do you check the API response time?
A: Tools like Postman, JMeter, or REST Assured show response time in milliseconds. It should meet the performance benchmarks (e.g., < 2000ms).
6. Q: How can you verify that request parameters are correctly passed to the API?
A: Review the request URL, query parameters, and body in tools like Postman and check the server response to confirm expected behavior.
7. Q: How do you ensure the correct HTTP method (GET, POST, PUT, DELETE) is used?
A: Review the API documentation and match the method used in your request with what is specified.
8. Q: How do you verify that the API endpoint URL is correct?
A: Compare the endpoint in your request with the API documentation and check for typos or wrong paths.
9. Q: How can you verify if the response headers are correct?
A: Check for required headers like Content-Type, Cache-Control, or Authorization using Postman or any API testing tool.
10. Q: How do you ensure the response payload size is within acceptable limits?
A: Check the Content-Length header or measure the size of the response using tools or scripts. Compare it with performance requirements.
11. Q: What should the API return if the request is malformed?
A: It should return a 400 Bad Request with a meaningful error message explaining what went wrong.
12. Q: What happens if the authentication fails in an API request?
A: The API should return a 401 Unauthorized or 403 Forbidden error with a proper message indicating auth failure.
13. Q: What should the API return if the request payload is missing?
A: A 400 Bad Request or 422 Unprocessable Entity with an error message should be returned.
14. Q: What if the requested resource does not exist?
A: The API should return a 404 Not Found response with a message indicating the resource was not found.
15. Q: What if the user is not authorized to access a resource?
A: The API should return a 403 Forbidden with an error message saying access is denied.
16. Q: What happens if the request payload exceeds the allowed limit?
A: The API should return a 413 Payload Too Large response or a custom error message depending on implementation.
17. Q: How should the API handle invalid data in the request payload?
A: It should return a 400 Bad Request or 422 Unprocessable Entity with details on the validation error.
18. Q: What if the HTTP method is not allowed for a specific resource?
A: The API should return a 405 Method Not Allowed response and may include an Allow header with supported methods.
19. Q: What should the API return after successfully creating a resource?
A: It should return 201 Created along with a success message and the new resource’s location or data.
20. Q: What should the API return after successfully updating a resource?
A: It should return 200 OK or 204 No Content (if no response body) with a success message confirming the update.
👉The Next 20 Questions-I: API TESTING
👉The Next 20 Questions-II : API TESTING