# Cannot access timeseries data via REST API getting error:  {"error":{"code":400,"message":"The timeframe is missing."}}

**URL:** <https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [May 16, 2018, 3:29pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775 "2018-05-16T15:29:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric\_schwartz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/eric_schwartz/32/35080_2.png) [@eric\_schwartz](https://community.dynatrace.com/u/eric_schwartz)\
**Post date:** [May 16, 2018, 3:29pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/1 "2018-05-16T15:29:51Z")

</div>

I am trying to access time series data using Powershell:

$Uri = “https://\<my\_tenant\>.live.dynatrace.com/api/v1/timeseries?timeseriesId=com.dynatrace.builtin:host.availability?relativeTime=hour?queryMode=total?aggregationType=avg”

$headers = @{}

$headers.Add(“Authorization”, “\<my tenant token”)

$headers.Add(“Content-Type”, “application/json”)

$headers.Add(“Method”, “POST”)

Invoke-RestMethod -Headers $headers $Uri

I get this error: Invoke-RestMethod : {“error”:{“code”:400,“message”:“The timeframe is missing.”}}

I know it isn’t an authorization issue since I can get other API URLs to work such as: “https://\<my\_tenant\>.live.dynatrace.com/api/v1/entity/infrastructure/hosts”

and “https://\<my\_tenant\>.live.dynatrace.com/api/v1/timeseries” without any parameters.

timeframe is also obviously in the URL :relativeTime=hour

(I have tried week and day also with the same error)

Thanks,

Eric

---

<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 16, 2018, 4:56pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/2 "2018-05-16T16:56:44Z")

</div>

You have question marks between your parameters, I think you want ampersands ‘&’. Like this:

https:// .&nbsp; [live.dynatrace.com/api/v1/timeseries?timeseriesId=com.dynatrace.builtin:host.availability&relativeTime=hour&queryMode=total&aggregationType=avg](http://live.dynatrace.com/api/v1/timeseries?timeseriesId=com.dynatrace.builtin:host.availability&relativeTime=hour&queryMode=total&aggregationType=avg)

Can refer to examples here:

[https://www.dynatrace.com/support/help/dynatrace-a…](https://www.dynatrace.com/support/help/dynatrace-api/timeseries/how-do-i-fetch-the-metrics-of-monitored-entities/#get-data-points-of-timeseries)

James

---

<div class="post-metadata">

**Author:** ![eric\_schwartz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/eric_schwartz/32/35080_2.png) [@eric\_schwartz](https://community.dynatrace.com/u/eric_schwartz)\
**Post date:** [May 16, 2018, 6:31pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/3 "2018-05-16T18:31:53Z")

</div>

[@James K.](https://answers.dynatrace.com/users/3513/view.html)

I got the same error when I changed the ‘?’ to ‘&’.

I also tried providing startTimestap and endTimestamp instead of relativeTime, still received the same error.

---

<div class="post-metadata">

**Author:** ![nj\_njoku](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nj_njoku/32/13710_2.png) [@nj\_njoku](https://community.dynatrace.com/u/nj_njoku)\
**Post date:** [May 16, 2018, 7:08pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/4 "2018-05-16T19:08:27Z")

</div>

Hey Eric,

The metric you are looking at does not accept the aggregation parameter. See the [doc](https://www.dynatrace.com/support/help/dynatrace-api/timeseries/how-do-i-fetch-the-metrics-of-monitored-entities/?&_ga=2.119012874.2094012742.1526494845-132949890.1526494845#get-data-points-of-timeseries) on that. Please take that out and let me know if it works for you.

Thanks

NJ

---

<div class="post-metadata">

**Author:** ![eric\_schwartz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/eric_schwartz/32/35080_2.png) [@eric\_schwartz](https://community.dynatrace.com/u/eric_schwartz)\
**Post date:** [May 17, 2018, 12:49pm UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/5 "2018-05-17T12:49:06Z")

</div>

NJ,

I got it to work by moving all of the needed URL parameters to a $Body variable and including that in the method Invocation: Invoke-RestMethod -Headers $headers $Uri -Body $Body

I was still getting the same error of ,“The timeframe is missing.” after I removed the aggregation and mode parameters. Thank you for the advice, it sent me down the right path to get it to work.

Eric

---

<div class="post-metadata">

**Author:** ![surajkumar\_pand](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@surajkumar\_pand](https://community.dynatrace.com/u/surajkumar_pand)\
**Post date:** [February 11, 2019, 7:16am UTC](https://community.dynatrace.com/t/cannot-access-timeseries-data-via-rest-api-getting-error-error-code-400-message-the-timeframe-is-missing/11775/6 "2019-02-11T07:16:59Z")

</div>

I am getting simmilar error for the timeseries API. Could you please help how to resolve this. I am trying the below URL.

curl -H “Content-Type: application/json” -k --insecure -H “Authorization: Api-Token xxxxxxxxx” -X GET [https://MyHost/e/8f1b215f-79f1-4a9d-b76a-25da9ce3394f/api/v1/timeseries/com.dynatrace.builtin:service.responsetime?includeData=true&relativeTime=hour&aggregationType=avg&entity=SERVICE](https://MyHost/e/8f1b215f-79f1-4a9d-b76a-25da9ce3394f/api/v1/timeseries/com.dynatrace.builtin:service.responsetime?includeData=true&relativeTime=hour&aggregationType=avg&entity=SERVICE)
