5. Understand JSON and XML
APIs often exchange data using formats such as JSON and XML.
JSON is especially common in modern web applications.
Example JSON response:
{
"id": 101,
"name": "Rahul",
"email": "rahul@example.com",
"active": true
}
As a QA engineer, you should know how to read this structure and validate its values.
For example, you can check:
- Whether the
idfield is present. - Whether the name matches the expected value.
- Whether the email has the correct format.
- Whether the
activefield contains a Boolean value. - Whether unexpected or sensitive fields are returned.
You should also understand arrays, nested objects, null values, strings, numbers, and Boolean values.
XML may still be used in some enterprise applications, so basic familiarity with its tags and structure can also be useful.
6. Learn Authentication and Authorization Testing
Authentication and authorization are important parts of API security testing.
Although these terms sound similar, they have different meanings.
- Authentication: Checks who the user is.
- Authorization: Checks what the user is allowed to access.
For example, an application may allow a normal user to view their own profile but restrict access to administrative functions.
Important test scenarios include:
- Sending a request without a token.
- Sending a request with an invalid token.
- Using an expired token.
- Checking access with a valid token.
- Verifying that users cannot access another user’s private data.
- Checking whether users with different roles have the correct permissions.
Practical example:
Suppose User A has an account ID of 101 and User B has an account ID of 102.
If User A attempts to access User B’s private information, the API should enforce the application’s access-control rules.
Do not assume that changing an ID in the URL is harmless. It can reveal an object-level authorization vulnerability if the server does not verify permissions.
7. Test Positive and Negative Scenarios
A good QA engineer tests both expected and unexpected inputs.
Positive testing checks whether the API works with valid data. Negative testing checks how the API handles invalid data and unusual situations.
Consider a user registration API.
Positive test scenarios
- Register with valid information.
- Register with all required fields.
- Register with supported characters.
- Register with a valid email address.
Negative test scenarios
- Submit the request without a required field.
- Enter an invalid email address.
- Send an empty request body.
- Use an unsupported data type.
- Submit a duplicate email address.
- Send values outside the allowed length.
- Provide malformed JSON.
Verify that the API handles each scenario according to its requirements and returns meaningful errors without exposing internal implementation details.
Also check that failed requests do not create unwanted records or partially update data.
8. Validate Response Data and Business Rules
Checking only the status code is not enough. QA engineers must verify whether the returned data is correct and follows the application’s business rules.
For example, imagine an API that calculates the total price of an online order.
The response might contain:
- Product price.
- Quantity.
- Discount.
- Tax.
- Final amount.
You should verify whether the final amount is calculated correctly according to the defined rules.
Other useful checks include:
- Required fields are present.
- Data types are correct.
- Values match the expected results.
- Dates follow the required format.
- Returned records match the search criteria.
- Duplicate records are handled correctly.
- Error messages are appropriate.
Business rule validation is important because an API can return a technically successful response while still producing incorrect business results.
9. Understand Query Parameters, Path Parameters, and Headers
Parameters help an API identify resources or control which information it returns.
Path parameters
These are included in the endpoint path.
Example: /users/101
Here, 101 identifies the requested user.
Query parameters
These are generally used to filter, sort, or paginate results.
Example: /products?category=books&page=2
Here, category and page are query parameters.
Headers
Headers carry additional information, such as content type and authentication details.
For example:
Content-Type: application/json
Authorization: Bearer <token>
In real testing, use an appropriate valid token instead of the placeholder shown above.
As a QA engineer, test missing parameters, invalid values, boundary values, unsupported headers, and combinations of parameters.
For pagination, check the first page, last page, empty results, invalid page numbers, and whether records are repeated or skipped unexpectedly.
10. Learn API Chaining
API chaining means using data from one API response in a subsequent API request.
This is a common technique in real-world testing.
Example workflow:
- Send a POST request to create a user.
- Extract the user ID from the response.
- Send a GET request using that user ID.
- Verify the user’s details.
- Send a PATCH request to update the user.
- Send another GET request to confirm the update.
- Send a DELETE request if cleanup is required.
This workflow checks whether multiple APIs work together correctly.
It also helps you avoid hardcoding IDs that may change every time the test runs.
In Postman, you can save response values in variables and reuse them in later requests.