Skip to main content
Solved

API - Streams time interval

  • November 25, 2024
  • 4 replies
  • 37 views

Forum|alt.badge.img+1

Hello, I would like to know if it is possible to get time data but like every 15 second of the activity instead of each second ? 

Thanks in advance,

Pierre

Best answer by ActivityFix

There’s no way to change the data returned from the streams. If you want something less frequent you will need to do processing on your side to get the data you want. Either taking every 15th data point in isolation or calculating averages for the stream in blocks of 15s.

View original
Did this topic help you find an answer to your question?

4 replies

ActivityFix
Superuser
Forum|alt.badge.img+24
  • Superuser
  • 232 replies
  • Answer
  • November 25, 2024

There’s no way to change the data returned from the streams. If you want something less frequent you will need to do processing on your side to get the data you want. Either taking every 15th data point in isolation or calculating averages for the stream in blocks of 15s.


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • 2 replies
  • November 25, 2024
ActivityFix wrote:

There’s no way to change the data returned from the streams. If you want something less frequent you will need to do processing on your side to get the data you want. Either taking every 15th data point in isolation or calculating averages for the stream in blocks of 15s.

Thank you ! do you have any tips then to not be limited by the max number of request per 15mn ? 


ActivityFix
Superuser
Forum|alt.badge.img+24
  • Superuser
  • 232 replies
  • November 25, 2024
pandrews wrote:
ActivityFix wrote:

There’s no way to change the data returned from the streams. If you want something less frequent you will need to do processing on your side to get the data you want. Either taking every 15th data point in isolation or calculating averages for the stream in blocks of 15s.

Thank you ! do you have any tips then to not be limited by the max number of request per 15mn ? 

If you’re hitting your rate limits, you’ll either need to request an increase or space out your requests.

All requests return your current API usage in the headers so you can use that to determine whether you have enough requests left in a 15m block. If your backend processing is set up to use a queue of requests, you can keep serving them until you hit the rate limit, then wait for the next 15m interval to tick over before resuming processing. Using that approach will let you smooth out usage over time, at the cost of things being a little delayed occasionally if there is a sudden burst of requests.

Also make sure you’re using the API as efficiently as possible. Meaning for streams, request all the streams you need in a single request rather than one at a time. Or for other API calls, if they have pagination be sure to request the maximum number of results you’ll need (most have a max of 200/page).


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • 2 replies
  • November 25, 2024
ActivityFix wrote:
pandrews wrote:
ActivityFix wrote:

There’s no way to change the data returned from the streams. If you want something less frequent you will need to do processing on your side to get the data you want. Either taking every 15th data point in isolation or calculating averages for the stream in blocks of 15s.

Thank you ! do you have any tips then to not be limited by the max number of request per 15mn ? 

If you’re hitting your rate limits, you’ll either need to request an increase or space out your requests.

All requests return your current API usage in the headers so you can use that to determine whether you have enough requests left in a 15m block. If your backend processing is set up to use a queue of requests, you can keep serving them until you hit the rate limit, then wait for the next 15m interval to tick over before resuming processing. Using that approach will let you smooth out usage over time, at the cost of things being a little delayed occasionally if there is a sudden burst of requests.

Also make sure you’re using the API as efficiently as possible. Meaning for streams, request all the streams you need in a single request rather than one at a time. Or for other API calls, if they have pagination be sure to request the maximum number of results you’ll need (most have a max of 200/page).

Super, thank you ! 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings