# Using Postman to Extract API Data

**URL:** <https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232>\
**Category:** Automations\
**Tags:** integrations, dynatrace-api\
**Created:** [October 8, 2019, 1:34pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232 "2019-10-08T13:34:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrobar](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jrobar](https://community.dynatrace.com/u/jrobar)\
**Post date:** [October 8, 2019, 1:34pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/1 "2019-10-08T13:34:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joe\_Hoffman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/joe_hoffman/32/30752_2.png) [@Joe\_Hoffman](https://community.dynatrace.com/u/Joe_Hoffman)\
**Post date:** [October 8, 2019, 3:42pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/2 "2019-10-08T15:42:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrobar](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jrobar](https://community.dynatrace.com/u/jrobar)\
**Post date:** [October 17, 2019, 2:09pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/3 "2019-10-17T14:09:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [October 17, 2019, 3:59pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/4 "2019-10-17T15:59:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrobar](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jrobar](https://community.dynatrace.com/u/jrobar)\
**Post date:** [October 17, 2019, 4:01pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/5 "2019-10-17T16:01:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrobar](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jrobar](https://community.dynatrace.com/u/jrobar)\
**Post date:** [October 18, 2019, 4:14pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/6 "2019-10-18T16:14:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joe\_Hoffman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/joe_hoffman/32/30752_2.png) [@Joe\_Hoffman](https://community.dynatrace.com/u/Joe_Hoffman)\
**Post date:** [October 18, 2019, 4:56pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/7 "2019-10-18T16:56:48Z")

</div>

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

> **[Dynatrace API - Tokens and authentication](https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication)**
>
> Find out how to get authenticated to use the Dynatrace API.

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

---

<div class="post-metadata">

**Author:** ![jrobar](https://avatars.discourse-cdn.com/v4/letter/j/858c86/32.png) [@jrobar](https://community.dynatrace.com/u/jrobar)\
**Post date:** [October 18, 2019, 5:46pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/8 "2019-10-18T17:46:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [October 18, 2019, 7:06pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/9 "2019-10-18T19:06:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![erick\_brambila](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/erick_brambila/32/25602_2.png) [@erick\_brambila](https://community.dynatrace.com/u/erick_brambila)\
**Post date:** [October 18, 2019, 9:10pm UTC](https://community.dynatrace.com/t/using-postman-to-extract-api-data/22232/10 "2019-10-18T21:10:22Z")

</div>

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.

> **[Use scripts to add logic and tests to Postman requests | Postman Docs](https://learning.postman.com/docs/tests-and-scripts/write-scripts/intro-to-scripts/)**
>
> You can use the Postman runtime to write scripts that add dynamic behavior to requests and collections.

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
