Body: <p>I'm using the v3 API to pull a list of participants for an event record. The call I'm making is:</p>
  
  <pre><code>$result = civicrm_api3( 'participant', 'get', array(
      'event_id' =&gt; $event_id,
      'options' =&gt; array(
          'limit' =&gt; 100,
      ),
  ) );
  </code></pre>
  
  <p>Usually, this works fine and pulls the participant information that I need. However, sometimes it will pull zero results (which is incorrect) but, on refreshing the theme page that displays the data, it will show the participants. It's like the first time through gets no results but primes the second try to be correct. It does not show zero records after the refresh, at least for a while.
  I cannot regularly recreate this error. As soon as I start pulling down participant records over and over, I don't see the problem show up.</p>
  
  <p>I know this is not a lot to go on but I'm not sure what else to check or how to reliably reproduce this in a way to show off the issue.</p>
  
  <p>Is there a different way to pull participants? Or is this potentially something amiss with CiviCRM?</p>
  
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-14T02:52:00.823Z
Comments.Text: Have you checked http://shouldiblamecaching.com? ;)
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-14T19:07:51.353Z
Comments.Text: @Coleman ... That brings up a good question. Are API calls via PHP cached? I would assume they're not. On the front-end, logged in users for this site are not served cached pages. Even then, just refreshing the page should not break the cache.
Comments.UserDisplayName: joshcanhelp
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-15T01:43:54.263Z
Comments.Text: Well, I guess the answer is "maybe." The CiviCRM api itself does not cache anything (well except getfields), but in other layers there might be caching going on. If it's an ajax api call you might get caching in your browser or reverse-proxy server. Certain BAOs (which serve results to the api) perform some caching. But I can't offhand think of why this particular call would be affected. I've never run into this kind of problem before.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-15T16:13:40.663Z
Comments.Text: @Coleman - It's all happening on page load, directly in PHP. Also, if it was cached, I would expect to see possibly a lower number of participants, not just "none" every time.
  
  Maybe someone should update shouldiblamecaching.com to "sometimes" or "maybe" :)
Comments.UserDisplayName: joshcanhelp
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-29T02:03:46.277Z
Comments.Text: Can you ensure that $event_id is always a value corresponding to a valid event id ?
Comments.UserDisplayName: samuelsov
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-30T14:02:35.573Z
Comments.Text: Well, the first load is using the same ID as the second one so I don't think that's the issue
Comments.UserDisplayName: joshcanhelp
Tags: <api>
Title: Participant Get API pulls no records first time, correct number after
ThreadText: # Participant Get API pulls no records first time, correct number after
  
  (Asked by: username_0 on 2015-07-13)
  
  I'm using the v3 API to pull a list of participants for an event record. The call I'm making is:
  $result = civicrm_api3( 'participant', 'get', array(
      'event_id' => $event_id,
      'options' => array(
          'limit' => 100,
      ),
  ) );
  
  Usually, this works fine and pulls the participant information that I need. However, sometimes it will pull zero results (which is incorrect) but, on refreshing the theme page that displays the data, it will show the participants. It's like the first time through gets no results but primes the second try to be correct. It does not show zero records after the refresh, at least for a while.
  I cannot regularly recreate this error. As soon as I start pulling down participant records over and over, I don't see the problem show up.
  I know this is not a lot to go on but I'm not sure what else to check or how to reliably reproduce this in a way to show off the issue.
  Is there a different way to pull participants? Or is this potentially something amiss with CiviCRM?
  Thanks!
  
  **Tags:** api
  
  > **Comments:**
  > **username_1**: Have you checked http://shouldiblamecaching.com? ;)  
  > **username_0**: @username_1 ... That brings up a good question. Are API calls via PHP cached? I would assume they're not. On the front-end, logged in users for this site are not served cached pages. Even then, just refreshing the page should not break the cache.  
  > **username_1**: Well, I guess the answer is "maybe." The CiviCRM api itself does not cache anything (well except getfields), but in other layers there might be caching going on. If it's an ajax api call you might get caching in your browser or reverse-proxy server. Certain BAOs (which serve results to the api) perform some caching. But I can't offhand think of why this particular call would be affected. I've never run into this kind of problem before.  
  > **username_0**: @username_1 - It's all happening on page load, directly in PHP. Also, if it was cached, I would expect to see possibly a lower number of participants, not just "none" every time.  Maybe someone should update shouldiblamecaching.com to "sometimes" or "maybe" :)  
  > **username_2**: Can you ensure that $event_id is always a value corresponding to a valid event id ?  
  > **username_0**: Well, the first load is using the same ID as the second one so I don't think that's the issue  
  
  ---
  
  ## 0 answers
  
  