Query Parameter or URL Placeholder on GET Collection

Hello

I suspect there is a topic on this, or some documentation, but I cannot find it. I maybe searching with the wrong terminology…

I am working in Appgyver and have a GET COLLECTION working, but I want to filter on a field/object. There are at least two ways I think I can do it, but I cannot get either to work…which perhaps means Backendless does not allow it…appreciate any hints!?

Method 1 - Query Parameter
I have the below config, but as you can see, further below, it fails to produce the desired result;


Method 2 - URL Placeholder
URL Placeholder - am testing the URL with the aim of putting in a placeholder, so I have this: …/data/UserWorkouts?ownerId=lisa@lisa.com. I would ultimately replace lisa@lisa.com with {} and link the placeholder to a page variable…but the above URL does not filter the collection by that ownerId when I test.

I thought this would be simple but clearly not.
Thanks
Paul

Help appreciated!?

Are you looking for help?

This is a support forum for reporting issues related to Backendless services. Please note that due to our support policy we cannot provide you help with debugging your code, consulting in regards to any language or third-party library usage. For this kind of questions we recommend using more appropriate forums like Stack Overflow.

In order to suggest you a quality solution, we shall usually ask you to provide the details mentioned below first. Including them into your topic right away helps us to start investigating your issue much faster.

In case you have a suggestion or an idea, the details below are not always required, though still any additional background is welcome.

Backendless Version (3.x / 5.x, Online / Managed / Pro )

Client SDK (REST / Android / Objective-C / Swift / JS )

Application ID

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

Be descriptive: “it doesn’t work” does not describe what the behavior actually is – instead, say “the request returns a 400 error with message XXX”. Copy and paste your logs, and include any URLs.

Reproducible Test Case

Please provide a simple code that could be run in a new clean app and reproduce the issue.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

Hi Paul,

When you say you want to filter on a field/object, do you mean you want to get only specific fields or you want to get the collection where the field values match certain criteria?

Both are possible with Backendless, I just need to understand a little better what you’re after.

Regards,
Mark

Hi Mark

It is the latter, I want to bring back the ‘row’ (or rows) of the table where one field (ownerID) matches a certain value.

To be really basic, each row of the table is a submission from individual/different users. The GET COLLEC will bring back all the rows for the logged in user, per the ownerID field.

Thanks for your help on this.
Paul

Hi Paul,

A condition that filters for objects that meet your selection criteria is called where clause in Backendless. I recommend you to play with REST Console that is built into Backendless console when composing a query. To do that:

  1. Login to Backendless Console
  2. Click the Data icon and select your UserWorkouts table.
  3. Switch to the REST Console tab. You will see an input field with the label called Where:
  4. Enter a where clause query and click the GET button. The result is displayed in the Response section. You can see the response either as JSON or in a grid view.

A where clause to get objects where ownerId is of a certain value, the where clause would have the following format:

ownerId = 'specific-value-for-the-field'

Once you get to the point where you get back expected results, use the Request URL field as it will have all the configured parameters in there. That’s the URL you would be using in your Appgyver app.

Hope this helps.

Regards,
Mark

Brilliant Mark. Thanks.