# Metrics Query API

**URL:** <https://community.dynatrace.com/t/metrics-query-api/35181>\
**Category:** Dynatrace API\
**Tags:** synthetic-monitoring, dynatrace-api\
**Created:** [May 18, 2022, 12:05am UTC](https://community.dynatrace.com/t/metrics-query-api/35181 "2022-05-18T00:05:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balamurugesh](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@Balamurugesh](https://community.dynatrace.com/u/Balamurugesh)\
**Post date:** [May 18, 2022, 12:05am UTC](https://community.dynatrace.com/t/metrics-query-api/35181/1 "2022-05-18T00:05:38Z")

</div>

Hi Team, I want to get the synthetic monitoring availability for all configured monitors for a month or year. I got to know that we can get it with metrics Query API. but am not sure about the timeframe and resolution i should pass while querying. Could you please provide the appropriate curl command to get these details?

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [May 19, 2022, 2:26pm UTC](https://community.dynatrace.com/t/metrics-query-api/35181/2 "2022-05-19T14:26:02Z")

</div>

I’ll refer to the answer just posted [here](https://community.dynatrace.com/post/186862).

The API Explorer lets you set the values for the timeframes and includes some tips:

 ![JamesKitson_0-1652970231542.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/0/f0d5f04661070ab826ac77b670e454cad71e8ced.png)

For 1 year you can enter **now-1y** &nbsp;in the from parameter. And the URL it sends and sample command displayed are updated accordingly:

```markup
curl -X GET "https://<dynatrace_hostname>/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.availability.location.total%3AsplitBy%28%22dt.entity.synthetic_test%22%2C%22dt.entity.geolocation%22%29&from=now-1y" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token <api_token>"

```
