by Robert Schrenk.
Hi,
I want to read all messages using the Webservices API. In order to load only new Items I want to use the parameter "limitfrom" as described in the API documentation.
In the first run I stored the latest messageid, but this did not work. So I expected the parameter to count the messages and store the amount.
In order to catch all messages (from-me-read, from-me-unread, to-me-read, to-me-unread), I need to call the webservice 4 times (is this correct???)
#1 Get all messages that have been sent to me and are read [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 18
[useridfrom] => 0
[read] => 1
[limitfrom] => 30 #2 Get all messages that have been sent to me and are unread [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 18
[useridfrom] => 0
[read] => 0
[limitfrom] => 0 #3 Get all messages that I have sent and are unread [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 0
[useridfrom] => 18
[read] => 0
[limitfrom] => 36 #4 Get all messages that I have sent and are read [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 0
[useridfrom] => 18
[read] => 1
[limitfrom] => 0
The limitfrom Parameter always shows the amount of messages that have been loaded during the first run.
Case #1 works as expected. It loads 30 messages in the first run, stores that amount. In the second run no more messages are loaded and the counter stays the same.
Case #2 and #4 do not show any messages (there are none), this is too expected behaviour.
Case #3 loads 36 messages in the first run, stores that amount. In the second run it loads again 36 messages, the counter doubles.
I have no idea whats going wrong here, is this a bug in the Moodle Code?
EDIT: The Moodle Version i used was 3.0.7
Regards
Robert