cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Postman to Extract API Data

jrobar
Participant

I am attempting to use Postman to extract second level data from the Dynatrace API. For example, I can extract both top level (adding no id) and second level (using id). What I would like to do is dynamically query any first level API (e.g. host) then using that dataset, loop thru the first level data to call the same API using the ID from the top level call, resulting in getting all data for that particular API.

 

9 REPLIES 9

Joe_Hoffman
Dynatrace Leader
Dynatrace Leader

Your approach sounds reasonable. Do you have a specific question?


jrobar
Participant

How do I get Postman to make multiple calls to the API passing the ids (one at a time i would assume) from the first request to a second request? Is there a limitation in Postman that will not allow this?




It’s rather question to postman community 🙂 in general such things may be easier to do in jMeter for example


Regards, Sebastian

jrobar
Participant

Yes, I'm asking there and I did see another reference that mentioned JMeter. Thanks


jrobar
Participant

Hopefully a quick question: where do I put the api-token in jMeter?



Dynatrace accepts the token as a query parameter or an HTTP Header. HEre's the doc page that describes this from the Dynatrace perspective.

https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/basics/dynatrace-api-authentic...

I assume you know how to define either of these in JMeter. If not, I recommend JMeter documentation.


Opps, what I mean is, in jMeter, what 'add-on' would I use for api-token. It doesn't seem to like it in the parameters of the HTTP request. In Postman, is was pretty straight forward.


You should read jMeter documentation related to authentication. You can pass api-token as query parameter in url, or as a header. You have jMeter documentation available online for both of them. I suggest watching some YouTube videos related to how to use jMeter. In general when you want to extract some data using jMeter automatically I suggest starting some basics about assertions.

Sebastian


Regards, Sebastian

erick_brambila
Contributor

i am not a postman expert here but as far as I have played with postman is not something it supports out of the box. you have to write a script to achieve this.

https://learning.getpostman.com/docs/postman/scripts/intro_to_scripts/

Where it would extract the first level of (iD) and save them to a variable which you can use to iterate over and extract the second level.

I usually use node JS to build more complex scripts, for example have one where I enter Env Ids and tokens for source and destination and I move management zones between environments and servers.. there is more logic in between where I manipulate the objects etc, etc..but you get the idea.

Regards,

Erick


Featured Posts