Introduction of the Basics of Postman, API (Application Programming Interface)

Postman is a popular platform used for testing, developing, and documenting APIs (Application Programming Interfaces).

If you're new to Postman and want to get familiar with basic terms and creating collections, you can continue reading our blog.

First and foremost, let's understand the key term you need to know, which is "API." To explain it simply, APIs are interfaces that allow software applications to communicate with each other. They are used for exchanging data and providing functionality.

What is Postman?

Postman is a developer tool that makes working with APIs easier. With Postman, you can create API requests, send them, inspect responses, and debug errors.

Now that we've explained the core concept of Postman, let's enhance your understanding and effectiveness in using Postman by explaining some key parameters one by one.

Request:

Requests are the actions you take to accomplish a specific purpose with an API. Requests can serve various purposes, such as sending data to a server, receiving data, or performing actions. A request typically includes the following components:

HTTP Method:

This specifies the purpose of the request, such as GET, POST, PUT, or DELETE.

URL (Uniform Resource Locator):

This is the address that identifies the resource you want to interact with.

Query Parameters:

These are additional data sent with the request, usually appended to the URL as "?key=value."

Body:

This is data sent, especially in methods like POST or PUT.

Headers:

These are header fields containing additional information about the request.

Response:

Responses are the answers you get back from an API request. They include information from the server and the status of the request. A response typically includes the following components:

Status Code:

This is a three-digit code indicating the general status of the server's response.

Headers:

These are header fields containing additional information about the response.

Response Body:

This is the data or content returned from the server.

HTTP Methods:

GET: Used to read data from a resource. Data is requested, but the server doesn't change it.

POST: Used to add new data or perform actions on the server.

PUT: Used to update an existing resource. If the resource doesn't exist, it can create a new one.

DELETE: Used to delete a resource.

Parameters:

Query Parameters:

These are data specified within the URL, typically in key-value pairs.

Path Parameters:

These are used to define the URL path. For example: "products/{category}" (where "category" is a path parameter).

Body Parameters:

These are data sent in POST or PUT requests. They can be in JSON or form data format.

Headers:

These are fields containing additional information about HTTP requests and responses. For example, the "Content-Type" header defines the content of the request or response.

Authorization:

This is used to grant access to an API. Typically, an API key or token is included in the Authorization Header.

Environment:

This is used to store variables and values for different servers or configurations. It prevents you from repeatedly entering the same values when working in different environments.

Collection:

This is a structure used to group related API requests and documentation. Requests are organized within collections, representing different parts of a project.

Now that we've covered the basics of Postman, let's explain how to create a collection and test it within Postman.

Let's say you want to create a collection for an e-commerce website.

Here are the steps you should follow:

Open the Postman Application:

Launch the Postman application and view the main interface.

Create a Collection:

  • Click on "Collections" in the upper-left corner.

  • Click the "New Collection" button that appears.

  • Enter the name of the collection, for example, "E-Commerce API Tests."

  • Optionally, add a description.

Add Requests to the Collection:

  • When you click on the created collection, click the "Add a request" button to add requests to it.

  • In the pop-up window, give your request a name, such as "List Products."
  • Choose the HTTP method you want to use, for example, "GET."
  • Enter the URL of the API resource, for example, "https://example.com/api/products."
  • Optionally, add query parameters or request settings.

Customize Request Settings:

After creating the request, you can go to the Headers section to add headers. For example, you can add an Authorization header with an API key if needed.

If the request requires a request body, you can add body parameters from the Body section. It can be in JSON or form data format.

Send the Request and Inspect the Response:

Click the "Send" button to send the request to the server.

You can review the response in the "Response" tab, including headers and the response body.

Save the Collection:

Don't forget to save the collection after adding and customizing requests. You can use the "Save" button at the top of the collection.

By following these simple steps, you can create a collection for API testing in Postman for an e-commerce website. You can add different requests to the collection to test various features and functionalities of the API.

After preparing your collection, when it comes to testing the collection in Postman, follow these steps:

Select the Collection:

Click on "Collections" in the upper-left corner and choose the e-commerce collection you created.

Choose a Request:

Select the request you want to test from within the collection. For example, let's choose "List Products."

Configure Parameters if Necessary:

Set any required parameters or body parameters for the request. For instance, you can add query parameters.

Configure Headers and Authorization:

Set request headers. If authentication is needed, add an Authorization header and provide the required authentication credentials.

Send and Inspect:

Click the "Send" button to send the request to the server. You can review the results in the "Response" tab.

Test Other Requests:

Test other requests in the same manner by selecting them, configuring parameters, sending, and inspecting responses.

By following these steps, you can test the collection you created in Postman.
We hope this blog post has contributed to your understanding of the basics of Postman and how to test your own collection in it.
For more information please
contact us.

Author: Nazlı Akbaytürk