Postman for APIs
Creating a Workspace¶
- Open Postman Agent
- Go to
Workspaces -> Create Workspace
- Select template according to your need
-
Name the template and hit create
-
request URL that indicates where to make the API call.
Variables in PostMan¶
- Select
Collection Name
on left hand menu, then the current variables will appear in the variables tab -
There are two columns
- Initial Value - value is set when someone forks or imports your collection. If you share your collection people will see this value so don't put sensitive information here.
- Current Value - Local value to your postman. Good to keep secrets (API KEYS) here.
-
minimum ingredients you need to make a request are:
- a request method (
GET
/POST
/PUT
/PATCH
/DELETE
, etc) - a request URL
- a request method (
- APIs allow you to refine your request further with key-value pairs called query parameters.
Path Variables¶
- The path variable comes immediately after a slash in the path
GET https://api.github.com/users/{username}
- You can have multiple path variables in a single request, such as this endpoint for getting a user's GitHub code repository:
GET https://api.github.com/repos/{owner}/{repoName}
Path Variable | Query parameters |
---|---|
ex: /books/abc123 |
ex: /books?search=borges&checkedOut=false |
Located directly after a slash in the path. It can be anywhere on the path | Located only at the end of a path, right after a question mark ? |
Accepts dynamic values | Accepts defined query keys with potentially dynamic values. |
* Often used for IDs or entity names | * Often used for options and filters |