-
Some example of what my PostgREST API returns for the following GET request:
[
{
"name": "Project 1",
"locations": [
{
"id": 4,
"name": "Observatory"
}
]
},
{
"name": "Project 2",
"locations": [
{
"id": 10,
"name": "Monwabisi Park"
},
{
"id": 8,
"name": "Lotus Park"
}
]
},
{
"name": "Project 3",
"locations": [
{
"id": 20,
"name": "Hillbrow"
},
{
"id": 4,
"name": "Observatory"
},
{
"id": 22,
"name": "eThekwini"
},
{
"id": 21,
"name": "UMhlathuze"
}
]
}
] I want to return only the projects that contain locations id = 4 and can't work this simple filtering out using postgREST fitlering language. I want to do something along these lines: and return just: [
{
"id": 1,
"name": "Project 1"
},
{
"id": 3,
"name": "Project 3"
}
] |
Beta Was this translation helpful? Give feedback.
Answered by
dnk8n
Apr 20, 2023
Replies: 1 comment 2 replies
-
Maybe better to provide the postgresql query that works:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the url I am after:
http://localhost:3000/projects?select=id,name&locations=cs.[{"id": 4}]
with url escaping:
http://localhost:3000/projects?select=id%2Cname&locations=cs.%5B%7B%22id%22%3A%204%7D%5D