# Fetching data from SaaS using Rest API

**URL:** <https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818>\
**Category:** Dynatrace API\
**Tags:** services-classic, dynatrace-api\
**Created:** [June 16, 2021, 7:54am UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818 "2021-06-16T07:54:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragarwal](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ragarwal](https://community.dynatrace.com/u/ragarwal)\
**Post date:** [June 16, 2021, 7:54am UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/1 "2021-06-16T07:54:32Z")

</div>

Hi, I am monitoring a java application hosted on a few servers/hosts using oneagent license. Dynatrace marks a number of requests as ‘Request to unmonitored hosts’ and ‘Requests to Public Networks’. These are basically ‘Called services’ for third party calls or requests going to internal unmonitored hosts. My question is- I want to fetch data like ‘Response Time’ and ‘Request Count’ for all these services using Rest API.

Currently what I find is - Creating key requests for each one of them and creating calculated metric for each one of them (Response time and request count separately) and fetching them one by one. The process is tedious and requires huge amount of effort for large number of services. Is there a better way to do this or fetch the data directly?

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 16, 2021, 12:56pm UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/2 "2021-06-16T12:56:16Z")

</div>

If you can get the data via the new data explorer or the multidimensional analysis chart, then you will need to put in a RFE so s more simplified solution could be provided.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [June 16, 2021, 5:44pm UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/3 "2021-06-16T17:44:19Z")

</div>

You might have some success defining them as a separate service:

> **[Monitor third-party services in Service Detection v1 (Services Classic)](https://docs.dynatrace.com/docs/observe/application-observability/services-classic/service-detection/service-detection-v1/monitor-3rd-party-services)**
>
> Configure how Dynatrace should monitor third-party services.

That will open new possibilities regarding fetching data through the API.

---

<div class="post-metadata">

**Author:** ![ragarwal](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ragarwal](https://community.dynatrace.com/u/ragarwal)\
**Post date:** [June 18, 2021, 7:47am UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/4 "2021-06-18T07:47:16Z")

</div>

Hi Antonio, I actually did that and by saying ‘creating key request’ in my question, I actually meant marking them as a ‘separate service’. But the problem is - Once they are created as a separate service, they mix into the entire services list and parsing them gets difficult. Especially when responses return service-IDs rather than human readable service names. So, there are 2 challenges: 1. Sorting them out from the entire list of services

2. Converting the service-Ids into service names.

For point 1. I could resolve it by creating tags and assigning it to services that I want to fetch through the APIs. The APIs then use filter paramater and gets back response for only the tagged services.

For Point 2. I manually added a list of key:value pairs into my code where keys are the service ids and values are the service names. The Api response is then parsed and compared against this list of key:value pairs. The metric values are then allotted accordingly to the backend.

This process is cumbersome and may require frequent modifications from time to time. If you are someone who needs to monitor a dynamic list of services, Point 2 may not work for you. I just hope there is some better way to do this completely through the api rather than hard coding values. Please Let me know if there is a better way?

---

<div class="post-metadata">

**Author:** ![ragarwal](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ragarwal](https://community.dynatrace.com/u/ragarwal)\
**Post date:** [June 18, 2021, 7:50am UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/5 "2021-06-18T07:50:04Z")

</div>

Hi Chad,

Yes by creating tags I could get them into MDA view and fetch them through API. But the problem lies in identifying these services because responses contain service IDs rather than service Names. Is there a way to get service names into the API responses?

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [June 18, 2021, 1:38pm UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/6 "2021-06-18T13:38:42Z")

</div>

I would go the tag way. Of course, you have to tag them as you mark them as separate services, but then it should be pretty straightforward.

---

<div class="post-metadata">

**Author:** ![ragarwal](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ragarwal](https://community.dynatrace.com/u/ragarwal)\
**Post date:** [June 18, 2021, 2:01pm UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/7 "2021-06-18T14:01:41Z")

</div>

What about the Service-Ids? Do you know a way to fetch service names instead of service IDs from the response?

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [June 18, 2021, 6:09pm UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/8 "2021-06-18T18:09:12Z")

</div>

In my case, I invoke the Entities v2 API, and then correlate the data.

---

<div class="post-metadata">

**Author:** ![ragarwal](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@ragarwal](https://community.dynatrace.com/u/ragarwal)\
**Post date:** [July 12, 2021, 5:21am UTC](https://community.dynatrace.com/t/fetching-data-from-saas-using-rest-api/31818/9 "2021-07-12T05:21:13Z")

</div>

Thanks. that Works!!
