user3794667384
user3794667384

Reputation: 437

Filter in GET with loopback

I am trying to GET users with a specific filter (such as the email is equal to "[email protected]").
The description says Filter defining fields, where, include, order, offset, and limit - must be a JSON-encoded string ({"something":"value"}), however typing {"email":"[email protected]"} simply gets all the users instead of just this one.
What am I doing wrong?

Upvotes: 1

Views: 671

Answers (1)

user8120138
user8120138

Reputation:

You should post your query url which looks something like this: http://localhost:3000/api/Model?filter=%7B%20%22where%22%3A%20%7B%22name%22%3A%20%22icecream%22%7D%20%7D

But if I had to guess, you aren't using a filter or where key in your object.

{"filter": {"key": "value"} } incorrect

{"where": {"key": "value"} } correct for the api explorer (because it puts filter there for you), incorrect for anything else

{"filter": {"where": {"key": "value"} } } correct

Upvotes: 3

Related Questions