Newsletter – Week 08, 2019

News:

Articles:

Videos:

RTFM: Postman learning

In nowadays I work much with different REST services, where generally I need to provide start and end dates in a  request to service. I’m using Postman tool for communication with the services. I love this tool very much, one of the benefits of this tool is the ability to use dynamic scripts written using Javascript language to prepare the required data. Previously I had some issues with expired dates in my requests, so I decided to make them dynamic.

In my cases dates are supposed to be in the format –  YYYY-MM-DD and I usually have such math for them:

  • start date = today + 1 day
  • end date = today + 4 days

I created two global variables in the Postman like startDate and endDate and scripted their initialization using Javascript:

old

So, the problem was solved pretty fast, but it wasn’t enough for me. I was curious if such a great tool as Postman has something inbound for the date manipulation. I went to the Postman site and started reading the documentation. Spending just a small amount of time on the site my curiosity was rewarded with a prize. The Postman allows using some of the inbound Node.js libraries in custom scripts. One of them is moment – an effective library for the date manipulation.

My problem was solved one more time in another way:

new

In my particular case above, both solutions look pretty similar and the usage of the special library doesn’t provide almost any benefits. But in some more complex cases, this might be extremely helpful.

So, the whole point here is: if you think you already know some tool just spend some time to read the documentation and you will be rewarded.

Newsletter – Week 07, 2019

News:

Articles:

Videos:

Newsletter – Week 06, 2019

News:

Articles:

Videos:

Newsletter – Week 05, 2019

News:

Articles:

Videos: