Get Record Collection for a specific user from Backendless to Appgyver

Hi,

We are developing an app with Appgyver and Backendless. An important feature we have to implement is that a logged-in user should be able to create multiple profiles.

We created a table in Backendless which would store all the form submissions from Appgyver. We would then like to retrieve the profiles created by each logged user on a separate page in Appgyver. Since each profile created in the table is associated with a user via the ownerid, we are trying to retrieve all the users (via the Get Record Collection in Appgyver) with the same ownerid. However, we can only do that via the where parameter. That is not something we can implement since the ownerid isn’t a static value that we can add to the options in the REST Console. Is there any other way we can implement this?

Appreciate any help!

Thank you,

Rebecca

Hi Rebecca,

Let me make sure I understand the scenario:

  1. There is a logged-in user in the app
  2. You need to retrieve all the profiles for the currently logged-in user
  3. Each profile you need to retrieve has the ownerId property.

Please confirm and we’ll come up with a solution.

Regards,
Mark

Hi Mark,

Thanks so much.

Yes. That’s exactly the scenario.

Rebecca

Hi @Freedom_Test_Kit

In that case, I can recommend you set up Owner Policy for the data table

https://backendless.com/docs/rest/data_security.html

see the [LAYER 4] Owner Policy.

At the end, each user will be able to load only the object created by the user (where ownerId equals the user objectId value)

Regards, Vlad

Hi Vlad,

Thank you for your response. I set up the Owner Policy for the data table. However, I am unable to retrieve the profiles created by a logged-in user. I’m not sure what to plug in the where clause area in the REST API to return the required data.

Please let me know.

Thank you,

Rebecca

Hi Rebecca,

This question comes up quite often so I wrote a little cookbook recipe describing how to configure Owner Policy:

Regards,
Mark

Hi Mark,

Thanks so much for sharing the cookbook recipe on how to configure the owner policy. I was able to retrieve the records created by the logged-in user on Backendless.


However, when I plug it into Appgyver, it returns an empty array which is understandable because the user isn’t logged in at the time the test is run.

To display the required data from the API when the user is logged in, I created a data variable that gets a record collection and stores it within that variable. However, that seems to be unsuccessful because it does not return any records that can be displayed on my page.

Could you please provide any direction from here?

Rebeca

Hi Rebecca,

I am not familiar with AppGyver and cannot tell you what needs to happen there. If you’re getting an empty collection, I assume it means there is no logged-in user.

Regards,
Mark

Hi Mark,

Thank you so much for your assistance. I was able to retrieve the records for the logged-in user on Appgyver. I was getting an empty collection because I didn’t attach the user token to it.

It works now! Thanks again.

Rebecca