Skip to content

Postman Guide

Ivo Yankulovski edited this page May 2, 2023 · 1 revision

Postman Guide

Create collection and input collection variables of the localhost server development cycle i.e. mycollection_host=http://localhost:8888 to access it using {{mycollection_host}} in requests or json body values. Add any additional notes and vars specific for your project and endpoints without global environment variables as credentials, tokens and secrets.

Create and configure folders for requests based on authentication method and endpoint groups. If you use Bearer Token, select it per folder and input global environment variable {{mc_token}}. All requests in the folder will send authentication header preconfigured, otherwise non-authenticated requests.

Use json raw body requests for POST, multipart data to POST a file, or url variables in the request field.

Use Pre-request Script to generate data:

pm.globals.set("mc_username", "newname" + Math.floor(Math.random() * 10000));

Use Tests to set response params:

var jsonData = pm.response.json();
pm.globals.set("mc_uid", jsonData["uid"]);
pm.globals.set("mc_another_id", jsonData["aid"]);

Export your collection to json as part of your project.

Clone this wiki locally