Postman
Request

Query Params
?KEY=VALUE
Path Variables
:userid
Scripts and tests
Basic test structure
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
Response assertions
pm.response.to.have.status(200);
pm.expect(pm.response.responseTime).to.be.below(200);
pm.response.to.have.header(”X-Cache");
pm.response.to.have.header(”X-Cache", “HIT”);
pm.expect(pm.cookies.has("sessionId")).to.be.true;
pm.expect(pm.cookies.get("sessionId")).to.equal("abcb9s");
pm.response.to.have.body( "OK");
pm.expect(pm.response.text()).to.include("Order placed.");
Variables
pm.globals.set("varName", "VALUE");
pm.globals.get("varName");
pm.globals.unset("varName");
pm.globals.clear();
pm.environment.set("varName", "VALUE");
pm.environment.get("varName");
pm.environment.unset("varName");
pm.environment.clear()
pm.variables.get("varName")
Learn Postman by Trello API
Postman Trello API requests and tests:
Create a trello board
Create two lists TODO and DONE
Create a new card inside TODO
Move the card to DONE
Delete the board
Variables
{{ENVIRONMENT_VARIABLES}} -> Use to easy switch environment. Allways is used before Global Variables
{{GLOBAL_VARIABLES}} -> The same like Environment but it's not easy to switch. And Environment variables has bigger priority.
Debugging tests
console.log(response.prefs);
and click Console to see it.
GitHub API
GitHub Repository
GET
https://api.github.com/user/repos
1. Authorization > Type - Basic Auth > Username/Password to GitHub 2. Send Request
Path Parameters
string
Create a new Repo
POST
https://api.github.com/user/repos
Request Body
description
string
"This is a test repository created by Postman"
name
string
"Test-Repository"
Check public Repo
GET
https://api.github.com/repos/:owner/:repo
Path Parameters
repo
string
Test-Repository
owner
string
testerBartek
Create Issue
POST
https://api.github.com/repos/:{owner}/:{repo}/issues
Path Parameters
{repo}
string
Test-Repository
{owner}
string
testerBartek
Request Body
body
string
"This issue has been automatically created by Postman"
title
string
"Found a bug"
Check created Issue
GET
https://api.github.com/repos/:{owner}/:{repo}/issues/:{issue_number}
Path Parameters
{issue_number}
string
1
{repo}
string
Test-Repository
{owner}
string
testerBartek
Delete GitHub Repo
DELETE
https://api.github.com/repos/:{owner}/:{repo}
Path Parameters
{repo}
string
Test-Repository
{owner}
string
testerBartek
Check deleted Repo
GET
https://api.github.com/repos/:{owner}/:{repo}
Path Parameters
{repo}
string
Test-Repository
{owner}
string
testerBartek
Collection and test run
Last updated
Was this helpful?