Why Insomnia and not Postman?

Well, answer is straightforward – apples vs oranges. Somewhat I prefer Insomnia, though it is just a simplistic API client. But this is exactly what I normally need without additional features and Insomnia seems to be fulfilling my daily needs.

img

variable values for Dev environment

img

img

Authorize URL looks as follows (IMPORTANT: never embed usernames, passwords in config files – rely on solutions like Hashicorp’s Vault, Azure KeyVault etc):

img

By peeking at results of the POST (Timeline) response from the server includes authorization Header that includes token value.

img

img

Subsequent Method can use the value just by manually copy pasting value of the header into authorization header of GET request:

img

img

Smarter solution is to define header in Header tab and use a function that will call POST Authorize method, grab the resulting authorization header value (Bearer token) and insert it into a header in the GET request. In value type CTRL+Space and look for function Response – Header:

img

img

Double click on red field and Edit tag window will pop up:

img

Now your requests will be using appropriate value for authorization header.

IMPORTANT: in order to have Edit tag pop up available you cannot enable (leave unticked) Raw template syntax as otherwise you’ll have manually craft in Nunjucks value of the header.

img