get most recent k messages pertaining to a user

0 votes
Hi,

I was wondering if I could get the most recent k messages by some API like getMostRecentKMessages()?

If not, does App42 have some plan on developing this feature soon because it is badly needed in our app?

For example, I have sent 500 messages to all of my friends. Now I need to get the most recent 20 messages based on the SendedOn field. With the current API, I  could only call getAllMessages to get 500 messages, and then do some local filter to get the most recent 20 messages. In this case, I don't think it is a scalable solution.

Thanks in advance for your answer!
asked Jul 19, 2014 in App42 Cloud API-BaaS by Bob Anoop (19 points)
recategorized Feb 13, 2015 by sushil

2 Answers

0 votes
Hi Bob,

This feature currently does not available however it looks valid and aligned with our SDK roadmap coming in next month.

We will update this thread once this is available.

Thanks

Ajay
answered Jul 19, 2014 by ajay123 (899 points)
Ok looking forward to seeing that!
+1 vote

Hi Bob,

Add these line just before your getAllMessages in buddy service to make it work..

  HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
  otherMetaHeaders.put("orderByDescending", "sentOn"); // set the order of messages
  buddyService.setOtherMetaHeaders(otherMetaHeaders);
  buddyService.setPageMaxRecords(20); //  set the number of messages
Thanks,
/Shashank.
answered Jul 22, 2014 by sshukla480 (407 points)
Hi sshukla480,

Although your solution is sort of "global configuration" that may affect other api calls (e.g. get all friends), this is a great and may be the only walkaround so far.
Thanks for your answer!
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...