Coconote
AI notes
AI voice & video notes
Try for free
๐งช
Using Postman for API Testing
Jul 4, 2024
Using Postman for API Testing
Introduction
Postman: Popular tool for testing various APIs.
Tutorial covers:
Sending different types of requests.
Sending images/videos for testing.
Tips for managing API structure.
Installation
Download Postman from
postman.com
and install it.
For simple API tests, consider using RapidAPI extension for VS Code.
Getting Started
Open Postman.
Options: Sign in, create a free account, or skip.
Create a new folder or collection:
Click the plus icon, name your project, and save all APIs in this collection.
Creating Requests
To create a request:
Click the three dots on your collection.
Select 'Add Request'.
Name the request (e.g.,
Fetching Books Data
).
Testing APIs
Example using Simple Book API (GET request):
Copy URL and paste it into Postman.
Append
/books
to the URL.
Select GET method from the dropdown.
Click 'Send' or press
Ctrl + Enter
(Windows) /
Cmd + Enter
(Mac).
View response details (status code, time, size, etc.).
Options to preview and save the response.
Sending Data with Requests
Query Parameters
Open the
Params
tab and write your parameters.
Example: Filter books by type (e.g., fiction).
Path Parameters
Create a request for single book details:
Use path parameters for book ID.
Syntax:
/books/:bookId
(Postman auto-adds path parameter fields).
Pass value and click 'Send'.
Alternatively, directly append the ID to the URL.
POST Requests
Create a new POST request for login:
Define the URL and select POST method.
In the
Body
section, select the appropriate data format (e.g., raw, JSON).
Pass JSON data (email, password).
Click 'Send' to see the response.
Sending Headers
Use the
Headers
section:
Add data in key-value pairs (e.g., JSON Web Token).
Sending Files (Images/Videos)
Go to
Body
section and select
form-data
.
Define variable name and choose data type (file/text).
Example: Send video file.
Customization
Click the settings icon:
General tab: Change font size, font style, etc.
Theme tab: Select dark or light theme.
Conclusion
Postman is user-friendly for API testing.
Reach out for doubts in the comment section.
๐
Full transcript