Understanding HTTP Status Codes and API Testing with Postman and Eolinker
This article explains common HTTP status codes, demonstrates step‑by‑step API testing using Postman—including basic requests, exception handling, token management, test assertions, and collection runs—shows how to import Postman collections into Eolinker, compares the two tools, and adds practical tips and code examples.
Every HTTP request receives a response with a status code indicating success or failure; common codes include 200 (success), 300 series (redirects such as 302), 304 (not modified), 400 series (client errors like 401, 403, 404), and 500 series (server errors like 500, 504).
Postman is used for basic testing by entering the endpoint, token, and parameters, then clicking Send. GET parameters are placed in the URL, while POST parameters go in the Body Data.
The second step covers exception testing, such as network issues, high concurrency, incomplete parameters, and token expiration.
The third step involves creating a test plan: set the token as a global variable using the script ${__setProperty(newtoken,${token},)} and reference it in the HTTP Header Manager as authToken:${__property(newtoken)} .
Postman’s token is valid for seven days; the URL can be parameterized via environment variables in the Manage Environments dialog.
The fourth step adds test assertions, for example:
var jsonData = JSON.parse(responseBody);
pm.test("Status code is 200", function(){
pm.response.to.have.status(200);
});Running the collection in the Collection Runner shows passed results for the tested interfaces.
Extended assertions can validate response content, such as checking video titles in a JSON response:
var jsonData = JSON.parse(responseBody);
pm.test("First video title is ***", function(){
pm.expect(jsonData.data[0].title).to.eql("***");
});
pm.test("Second video title is ***", function(){
pm.expect(jsonData.data[1].title).to.eql("***");
});Eolinker is a professional API management platform that can import Postman collections (exported as JSON) and provides features like API documentation generation, testing, and team collaboration.
Importing a Postman collection into Eolinker involves selecting the exported JSON file, after which test cases appear in the project.
Additional tips include ensuring GET request URLs have no trailing spaces, handling environment variables during import, and using Eolinker’s batch URL modification feature.
Finally, the article includes a promotional section encouraging daily interaction (comments, likes, shares) for a chance to win custom mouse pads, with weekly statistics and a discussion prompt comparing Postman and Eolinker.
FunTester
10k followers, 1k articles | completely useless
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.