How To Use Postman Web Version
Getting Started with Postman Web Version
Postman is a powerful tool for API testing, and its web version offers a convenient way to get started without any local installations. Here’s a step-by-step guide on how to navigate and use Postman in the browser:
1. Accessing the Postman Web Version
- Visit the Website: Open your web browser and navigate to https://www.postman.com/.
- Sign Up or Sign In: If you don’t have an account, click “Sign Up” and create a free account. Otherwise, click “Sign In” to access your existing workspace.
2. Creating Your First Request
- Open the Postman App: Once signed in, you’ll be redirected to the Postman web app.
- Start with a New Request: Click the “New” button in the top-left corner and choose “Request.”
- Choose a Method: Select the HTTP method you want to use from the dropdown (e.g., GET, POST, PUT, DELETE).
- Enter the Request URL: In the “Enter request URL” field, type the URL of the API endpoint you want to test.
Example:
https://reqres.in/api/users
3. Sending Your First Request
- Send the Request: Click the “Send” button to execute the request.
- View the Response: The response from the server will be displayed in the “Response” pane, including the status code, headers, and body.
Example (GET Request):
- Request Method: GET
- Request URL:
https://reqres.in/api/users
- Response Status Code: 200 OK
- Response Body: (JSON data containing user information)
4. Adding Headers and Body
- Headers Tab: Click the “Headers” tab to add or modify request headers.
- Body Tab: Click the “Body” tab to send data with the request (e.g., JSON, XML, form data).
Example (POST Request with JSON body):
- Request Method: POST
- Request URL:
https://reqres.in/api/users
- Headers:
- Content-Type: application/json
- Body:
{"name": "John Doe","job": "Software Engineer"}
5. Working with Collections
- Create a Collection: A collection helps organize your requests and related documentation. Click the “New” button and choose “Collection.” Give your collection a descriptive name.
- Add Requests: Drag and drop requests into your collection. You can also create new requests directly within the collection.
- Share Collections: Share your collections with collaborators for team collaboration and efficient API testing.
Example Collection:
- Name: User API
- Requests:
- Get Users
- Create User
- Update User
- Delete User
6. Utilizing Variables
- Define Variables: Variables allow you to reuse values across multiple requests within a collection. Click the “Variables” tab in your collection to define variables.
- Use Variables in Requests: Use the
{{variable_name}}
syntax to insert variables into your request URLs, headers, or body.
Example:
- Variable:
baseUrl
with valuehttps://reqres.in/api
- Request URL:
{{baseUrl}}/users
7. Using Tests
- Add Tests: Go to the “Tests” tab and write JavaScript code to run assertions against the API response.
- Assertions: Use Postman’s built-in test functions to check for expected values, status codes, or headers.
Example (Test for Status Code 200):
pm.test("Status code is 200", function () { pm.response.to.have.status(200);});
8. Automating with Scripts
- Pre-request Scripts: Write code in the “Pre-request Script” section to execute actions before sending the request (e.g., generate dynamic data).
- Tests Scripts: Use the “Tests” section to perform actions after receiving the response (e.g., log data, update variables).
Example (Pre-request Script to generate a random number):
let randomNumber = Math.floor(Math.random() * 100) + 1;pm.variables.set("randomNumber", randomNumber);
9. Collaboration and Sharing
- Team Workspaces: Organize your work by sharing collections and requests with team members in a dedicated workspace.
- Sharing with External Users: Grant access to specific collections or requests for developers or stakeholders outside your team.
Postman is a powerful tool that empowers you to test and document APIs efficiently. By utilizing its web version, you can easily access and leverage its features without any local installations.