Support Topics Documentation Slack YouTube Blog

Finding multiple users with their id

Hello.

How do I find multiple users with their id on a single api call.

What I mean is let say a user has 10 followers with their Ids already gotten, and he wants to get the Address of all those users on address table using their id on a single call.

Help please.

Hello,

If you know objectId values, you can retrieve the objects using a query (where clause) formatted like this:

objectId IN ( "objectId1", "objectId2", "objectIdN" )

where objectId1, objectId2 and objectIdN are specific values. For information on how to use where clause in the API, see the documentation at:
https://backendless.com/docs/android/data_search_with_where_clause.html

Regards,
Mark

OK thanks for the response. Let me explain further so u understand what I really want.

I want to retrieve the address of every user “userA” follows with just a single api call with their ids.

I am getting the ids from a table where I stored Id of every user the current user follow. So basically the ids are a response Of an api call

Let say the user follows 20 people I want to show him all the Address of all those 20 people in a single call.

This line of code works but not retrieving all 20 at once.

HI @Yomade_Stephens

for getting more that 10 (default value) objects you can use paging API

Regards, Vlad

Hi @vladimir-upirov.

I am not saying page size am well aware of that.
What I need is can I pass multiple users id in size of 20 or 30 or 50 and more in the where clause to retrieve their response. What am trying to do is like retrieving all the post of all the user you follow on instagram simple. How do I retrieve the address of all the user the current users follows.

Am adding the Id Of The user the current user follows in where clause from the response Of the table where they all sit.

Like so

Backendless.data.of(following.class).find(where ownerId = currentUserId, asy {

Response

// let say response size is 50 here.
So am getting 50 ids

For (int I =0; i< response.size; i++){
Wherclause wherclause = “ownerid IN (’”+response.get(i).getid+"’ ,’"+ currentUserId+"’)";
// am trying to get Address of users the current user is following and also his/her address also.

Querybuilder. Setwherclause (whereclause);
Backendless.data.of(address.class).find(querybuilder, asy {

})
Fault

});}

have you tried to use relations API

for instance, you are able to load users and now you just add related properties to the query using “addRelated(“addresses”)” method, as a result, you will have a list of users where each user has a list of addresses

Is this what you are looking for?

Regards, Vlad

Let me try this. Will get back with the results.

But can I retrieve both a where clause and relation as a response.

Like I add a where clause in my query and find relation too. Is it possible?

yes, it is possible