Wow can postman do that - 1
Tags: todayilearned, webdev, javascript, beginners
Published: 2020-12-02 06:58:31

![hello](https://media.tenor.com/images/4f20af75f32887384aab7e49c37537ae/tenor.gif)

Feels good to be back on this amazing platform. I am just back from a writer's block. 

### Thanking note
{% twitter 1331594928929927168 %}
Thank you so much for all the support, you are the best 🙌🏻

### Series update

After these series 

- [Can python do that?](https://dev.to/gillarohith/wow-can-python-do-that-53ih)
- [Tailwind](https://dev.to/gillarohith/dev-to-clone-with-tailwind-css-mp8)

Here I am back with `postman` series. There are a few amazing things to talk about in the application. My initial impressions changed from a low to super high on Postman after getting to know them.

### Backstory

While I was pondering on what topic to write upon, `Paladins Stats App` finally struck me. **Paladins** is a desktop game by Epic Studios. I like to play that game and also like to compare stats and check my old history. There isn't a great application which does all of them, so I decided to try to build one.

![Paladins Image](https://m.media-amazon.com/images/M/MV5BMzI3ZjY0ZGMtMTFhOC00MDBmLTgzNjEtOTA4NTQzYzFiNmM3XkEyXkFqcGdeQXVyNTk5Nzg0MDE@._V1_.jpg)

For that initially, I needed to request the keys from the company, it was a simple process to fill the form and they will get back to you real quick.

### How I use to work with the API

![Shy](https://media1.tenor.com/images/6a8d5b754567ef4ea08675ae753e854e/tenor.gif?itemid=5141988)

Initially, when I have to work with some API, the first thing I do is to check the response format. If the API  majorly involves the use of the `GET` method I check the response of the API directly in the browser tab 😛

I use a few extensions to make sure they are formatted in a human-readable manner 😌

When once I had to use more `POST` methods then decided to use a tool called `Postman`

### Postman

**Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster**

![Postman Logo](https://miro.medium.com/max/802/1*dLWPk_rziSpWhPx1UWONbQ@2x.png)

### Workflow at the start

Now on to the main topic, initially I haven't realised the power of postman. For the Paladins API, I need to generate a signature which had to be attached to the URL of the request. This needed to be dynamic and should also be present in **every** request the API makes.

So TL;DR on how to make the signature.

```jsx
`${developerId}${methodName}${FORMAT}${authKey}${timeStamp}`
```

The above is the string which needed to be hashed with `MD5` algorithm.

**Python**

```jsx
from hashlib import md5
md5(string_to_hash)
```

**JavaScript**

```jsx
const signature = CryptoJS.MD5(`${developerId}${methodName}Json${authKey}${timeStamp}`).toString();
```
This is how hard the request was 👇
![Noob](https://dev-to-uploads.s3.amazonaws.com/i/acqboybhv70zkjz2klj6.png)

### Workflow at the end

Well, this was really nice, can you believe if I said I need not compute the signature every time using python and then insert in `GET` request.

![surprise](https://media1.tenor.com/images/e356deeba608e05e43fa742429110bb9/tenor.gif?itemid=7187491)

It is possible with [Postman pre-request scripts](https://learning.postman.com/docs/writing-scripts/pre-request-scripts/)
By including code in the Pre-request Script tab for a request, collection, or folder, you can carry out pre-processing such as setting variable values, parameters, headers, and body data. You can also use pre-request scripts for debugging code, for example by logging output to the console

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fgtesu9mzj10g9rveq3o.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ztsbtey2t5defwyo0x6k.png)

The screenshot below shows how elegant the postman looks now in comparison to the earlier one.

```jsx
{{URL}}/{{methodName}}{{FORMAT}}/{{devID}}/{{signature}}/{{session}}/{{timeStamp}}/{{LANGUAGE_CODE}}
```


### Next up

Next up is really cool, have you faced a situation where you needed to use authentication key from one request and needed to use in another one? Then the next post is for you, how do we pseudo chain the requests in postman in an easy way.

### Alternatives to postman?

- Insomnia
- Paw
- Hoppscotch (Postwoman is now Hoppscotch)

Do let me know in the comments below if I missed any 👇

Do follow so that you don't miss a notification when the next amazing post lands up.

![Thanks](https://media.tenor.com/images/20689feb56ded722084d5fa40cd31a6d/tenor.gif)

Peace ✌🏻
Rohith Gilla