# Postman

Postman is a phenomenally useful tool for documenting and querying REST-ful APIs. However there are a few shortcomings which we've had to find workarounds for. This page describes all the tricks that we've used in order to allow you to get the most out of our Postman collections

# How to document multiple responses

Spike documents every possible output for a path. We show these as examples in postman.

All valid responses (errors and successes) will reflect as http 200. We even document the non-200 response using the examples e.g.

# How to document multiple request types

Postman by default is not designed to support functions that return inputs with different schemas. We use the a trick in order to allow us to fully document our functions and list all possible inputs, namely we duplicate the path:

Note in the demo below the /cat-or-dog path accepts 2 different possible inputs:

input 1 = cat

input 2 = dog

# How to create base64-encoded values

The /pdf endpoint takes a base64 encoded file as an input. How do you enter this into Postman? Here's a convenient shortcut (works on Unix or WSL):

# file
base64 -w 0 /path/to/your.pdf | xclip -selection clipboard
# the base64 pdf has been copied to your clipboard - you can now paste it into the appropriate parameter or body in Postman

# token
cat /path/to/your/token | xclip -selection clipboard
# the token has been copied to your clipboard - you can now paste it into the appropriate authorization parameter in Postman
1
2
3
4
5
6
7

# How to copy code snippets

You can use postman in order to generate snippets of code in multiple programming languages. For example here's how you can copy a curl snippet:

First copy a snippet in Postman

Now you can cut-n-paste into a terminal

  • Note: remember to edit and replace variables and params as required
Updated: 7/21/2021, 9:29:43 AM