The 'count' parameter of 'GET direct_messages/events/list'



Hi. I am working on getting all Direct Message events with GET direct_messages/events/list. For “count” parameter, the documentation says “Max number of events to be returned. 20 default. 50 max”. My code is like below.

$content = $conn->get("direct_messages/events/list", ["count"=>50]);

Below is the response I got.

  public 'events' => 
    array (size=41)
      0 => 
  public 'events' => 
    array (size=19)
      0 => 

The total number of messages is 60. But the max count of messages returned from one request was 41, not 50.

Any ideas? Thank you!


As you pointed out from the documentation

Max number of events to be returned

The API may return less than the count parameter requests.


Gosh, I am using your Twitter library. Thank you for the reply, abraham!

I think the “50 max” on documentation means if I set "count"=>50 (there are more than 50 messages in my Twitter account), the API would return exact 50 messages. Isn’t it right? Did you mean that the max count means the API would return a random number of messages and the random number is less than the count parameter?


Max number of events to be returned. 20 default. 50 max

That actually specifies two different maxes.

Max number of events to be returned.

Adding count=n specifies that n is the max number of events to return. There may not be enough events to full the request and so less would be returned.

50 max

The value of count can not be larger than 50.

closed #5