How to Compare API 1 data and putting logic for API 2 data?

Hi,

I have two APIs,

One API gets License information for the site 697
and 2nd api gets Products Activity for site 697 …

How can i make it that if a specific Mock Survey and Tracers with AMP plus CMS Hospital license
expiration date is > todays date - 30
then
for API 2
ProductID =3 should be isActive: True else Not…

API 1:

API 2:

You need to set all relevant data in Postman variables.

Do the computations and write a Postman test.

I do get that but how would i go about with the proper javascript string … and connect it with API2… ?

Step #1: Did you set the data that you need in Postman variables?

Hi @shahbaz.shiekhqa

There are a few things you may need to do to have Postman perform the calculations for you:

  1. Check out the article below to understand how to extract and use specific strings from your JSON responses in additional APIs. This article was written by @abhinav: https://blog.postman.com/extracting-data-from-responses-and-chaining-requests/

  2. You can use test scripts to perform the date calculations in JavaScript after API 1 receives the JSON response. Store the calculation results in Environment variables.

  3. We will need further context and information to understand how to use API 2 to display the appropriate Boolean value for each ProductID.

save your api1 data in variables and use that logic in api2 data testscripts. as mentioned by @jerry-li in 1st point.

I did this for a similar one,
API 1 -

API2 - Need to verify the variables in API1 - match or = to the same in API2