Start a new topic

Get multiple users

Hello, 


I'm a bit new to kinvey...been playing around with it for some days and I faced a problem I can't figure out...


How can I get multiple users (by id) with one request to the REST API of kinvey. I'm trying to figure it out for hours but still no luck.


Thanks in advance! 


Cheers from Bulgaria.


Hi,


There are two options:

  1. You can lookup one user by using this API request: http://devcenter.kinvey.com/rest/guides/users#lookup
  2. You can query user collection with following GET query: /user/kid_xxxxxx?query={"_id":{"$in":["_id_of_user_1","_id_of_user_2"]}}


I have tested both successfully with Kinvey API console. Will one of these options work for your use case?



Regards,

Wani

Kinvey Support

Ah, Aniruddha, thank you for the help!


This is exactly what I was looking for - the second option! 


In my case I have a pivot table, collecting user ids, related to the user ids of their friends. I need to query all the friends of a particular user by their id's and the / $in: [...] / option is excellent for my purpose.


Thank you again.


Bobby.

Login or Signup to post a comment