0

I am using Flurry for analytics inside my native app and it records just perfectly, but... Now I want to make an backend admin page to my app and want to view the stats on my page. I have no problem getting one API request into my page, but when trying to ask a second nothing happens? Here is how I try to accomplish this:

// Daily activity users //
$djsondata = file_get_contents("http://api.flurry.com/appMetrics/ActiveUsers?apiAccessCode=".$flurryAccessCode."&apiKey=".$flurryIOSKey."&startDate=".$startDate."&endDate=".$nowDate."");
$dailyArray = json_decode($djsondata, true);
$day = $dailyArray['day'];

echo '<pre>1: ';
print_r($dailyArray);
echo '</pre>';

// Weekly activity users //
$wjsondata = file_get_contents("http://api.flurry.com/appMetrics/ActiveUsersByWeek?apiAccessCode=".$flurryAccessCode."&apiKey=".$flurryIOSKey."&startDate=".$ystartDate."&endDate=".$nowDate."");
$weeklyArray = json_decode($wjsondata, true);
$week = $weeklyArray['day'];

echo '<pre>2: ';
print_r($weeklyArray);
echo '</pre>';

If I comment out the first API call I get data in the second?!? Am I missing something here or is it only possible to ask the API once?

Any help is appreciated and thanks in advance :-)

Mansa
  • 2,277
  • 10
  • 37
  • 67

1 Answers1

1

This would likely be fixed by adding a 1 second delay (ie sleep(1)) between the API requests as there is an API rate limit of 1 request per second.

"The Flurry API only allows clients to make a limited number of calls in a given minute. - The rate limit for most APIs is 1 request per second. In other words, you may call the API once every second." Source: https://developer.yahoo.com/flurry/docs/api/

To avoid visible delays, you could run these requests in a cron script that runs every minute or hour and saves the data locally for future requests.

Ben
  • 11
  • 1