Skip to content
Course outline: Career kit

Module 04 · Career kit

API testing interview questions

15 questions an interviewer may ask about API testing, each with a short answer you can say out loud.

  • 15 questions
  • 3 min read
  • Free, no sign-up

Questions and answers

Define what an API is.

An API (Application Programming Interface) is a set of rules that allows different software applications to communicate with each other.

What is API Testing, and why is it important?

API Testing validates the functionality, reliability, performance, and security of APIs, ensuring correct data exchange between systems.

Differentiate between SOAP and REST APIs.

SOAP is a protocol using XML and strict standards; REST is an architectural style using HTTP and supports multiple formats like JSON and XML.

How do you test a RESTful API using tools like Postman?

By sending HTTP requests (GET, POST, etc.), setting headers and payloads, and validating responses using assertions in Postman.

Explain the HTTP methods GET, POST, PUT, PATCH, and DELETE.

GET: Retrieve data. POST: Create new data. PUT: Update/replace data. PATCH: Partially update data. DELETE: Remove data.

What are HTTP status codes? Give examples of 2xx, 4xx, and 5xx codes.

Status codes indicate response results. 2xx: Success (200 OK), 4xx: Client error (404 Not Found), 5xx: Server error (500 Internal Server Error).

How do you handle authentication in API Testing (e.g., API keys, OAuth)?

By including authentication tokens, API keys, or OAuth credentials in request headers or parameters as required.

Explain the concept of JSON vs. XML for data exchange in APIs.

JSON is lightweight, easy to read, and widely used; XML is more verbose and supports complex structures but is less common in modern APIs.

What is the significance of request headers and response headers in API Testing?

Headers provide metadata (e.g., content type, authentication) and are essential for correct API communication and validation.

How do you perform data-driven testing for APIs?

By running the same API tests with multiple sets of input data, often using external files or parameterization.

What is an API mock or stub, and when would you use it?

A mock or stub simulates API responses, used when the real API is unavailable or to test specific scenarios.

What is Swagger (OpenAPI), and how does it help in API Testing?

Swagger (OpenAPI) is a specification for documenting APIs, enabling automated test generation and easier understanding of endpoints.

What is meant by “idempotent” in the context of PUT and DELETE?

Idempotent means repeated requests have the same effect as a single request (e.g., PUT and DELETE should not cause unintended side effects).

How would you handle performance testing for APIs?

By using tools like JMeter or Postman to simulate load, measure response times, and identify bottlenecks.

Give an example of a typical test scenario for an e-commerce API (e.g., add to cart).

Send a POST request to add an item to the cart, verify the response, and check that the cart reflects the correct item and quantity.

New to some of these? Read the lesson behind this topic.

More interview topics

Put the lessons to work on a real site

Describe a user journey in plain English. QAIA walks it in a real browser and hands back the test cases, the automation code and the evidence of every step.