-
❤️ You can export collection via CLI in postman as described in this comment - Click here
-
TODO: Learn tests with postman -
- Open link in browser
- We can mark collections as starred so that they appear on the top like that -
- We can use params ❤️❤️ in postman with a beautiful syntax like that:
- Delete workspace (#remove workspace)
- TODO: Learn how teams work in postman
- Choosing between collection variables vs. environment variables
NOTE: Environment variables always override collection variables.
- Important: Postman never read values form "Initial value" column ever.
- Inheriting authorization from authorization defined in collection settings
Beware Beware Beware that you must remove "Inherit Authorization" from the signin/login requests as shown in below screenshot otherwise your' backend may intercept those requests badly. (WARNIN: In slasher it actually does).
- Setting variable at collection level:
var jsonData = pm.response.json();
// 1. setting in currently active environment (MOST COMMONLY NEEDED, Date: 28 May, 2023)
pm.environment.set("TOKEN1", jsonData.token);
// 2. setting collection variable
pm.collectionVariables.set("TOKEN1", jsonData.token);
// 3. setting globally
pm.globals.set("TOKEN1", jsonData.token);- Thats how you set collection specific variables:
- Thats how you export a postman collection:
- There are three types of variables-
- To use a environment variable, make sure you have an active environment:
- Realistic Example of setting and using a global variable (global environment variable):
- Thats how you set a global variable with postman tests:
-
Course video:
-
Socket.io Server Requests
Source: Official Postman Article - Click here
- You can choose client version now:
- Set url of socket now (connects automatically to:
localhost:PORT/socket.io):
- You can set authorization header with socket like that (even though browsers don't allow setting headers for socket connections yet ~Eric Slasher Project Notes):
- Listening to event and sending event (see next screenshot as well):
-
How do we get the return value (Acknowledgement) from the event as we can see the return value of the event handler in the code:
-
You can write documentation for a postman requets like that:
- In a request payload you can now write comments with
//and/* */format by adding that pre-script code
Source Stackoverflow Answer: Click here
// Strip JSON Comments
if (pm?.request?.body?.options?.raw?.language === 'json') {
const rawData = pm.request.body.toString();
const strippedData = rawData.replace(
/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g,
(m, g) => g ? "" : m
);
pm.request.body.update(JSON.stringify(JSON.parse(strippedData)));
}
// To set Content-Type again (see the original stackoverflow answer's comment section):
// pm.request.upsertHeader({key: 'Content-Type', value: 'application/json'});- Also you can make use explicit comment section to make notes as well:
- Hidden Headers?
-
Thats how you can use param variables (actually called
path variablesin postman) -
Set authorization "bearer token" header easily
- How to send file in http request
In slasher:
- We can fetch an image in postman as well:




































