Postman Galaxy Tour Workshop

Logo

Supporting resources for the 2020 Postman Galaxy Tour bit.ly/postman-galaxy-workshop

View the Project on GitHub postmanlabs/galaxy-workshop

Liftoff

Liftoff

So far we have tried running collections, shared data between requests, and used some basic test scripting. In this section we will look at generating documentation, using Postman on the command line, and the Postman API.

1. Generate documentation

You can generate user documentation for an API directly from your Postman collections. Documentation can include instructional text and images, request details, example request and response code, and code snippets in different languages.

To see a great demo of how you can use Postman for developer onboarding, check out the ShipEngine Walkthrough collection.

  • Create a free ShipEngine account and get a sandbox API key by visiting shipengine.com/postman (make sure you use this link as they’ve kindly raised rate limits for us).
  • Select “United States” as your country when signing up for this free account to enable the sandbox environment.
  • Add your ShipEngine key value in the collection variables as the API_KEY and try out the first request.

2. Version control

You can version your collections and manage changes via forks and pull requests.

3. Run a collection from CLI with Newman

You can run collections from the Postman CLI Newman—which in turn facilitates integrating collection runs with your CI/CD pipeline—for example if tests fail you could set an exit flag to prevent deployment.

In order to use Newman, you will need to install Node.js, a package manager like npm, and Newman using a command like npm install -g newman. If you don’t already have node and npm on your computer you might want to watch this part and get setup to try it yourself later.

We can also run a collection in Newman from a Postman account—in order to do that we need the collection ID, which we can get using the Postman API.

4. Use Postman API

Let’s use Postman to call the Postman API so that we can get a collection ID to run via Newman. The Postman API provides access to your Postman account data, including collections. You can access it like any other API—it also has a Postman collection to make calling it inside Postman straightforward.

newman run https://api.getpostman.com/collections/collection_uid?apikey=postman_api_key

The key you see on screen will be revoked immediately after the workshop—note that if you accidentally commit a Postman API key to a public repo on GitHub you will receive a notification alerting you to the leaked key.

[winter solstice art](https://apod.nasa.gov/apod/image/1712/WinterSolsticeMW_Seip.jpg)

Recap

In this section we covered:

Questions?

Shout out any questions you have on documentation, Newman, or Postman API.

Kahoot

Go to kahoot.it and enter the pin show on the screen—answer the questions as quick as you can to win an Amazon gift card!

Additional resources

Check out the Postman docs:

Next steps

Next up let’s overview some topics for further learning: Activate thrusters.