Skip to content

API: Filtering records by ID

Logan Serman edited this page Jan 14, 2015 · 1 revision

APIs accept an ids parameter to filter the results to records with the provided ids. The ids parameter should be comma delimited. This is useful when your API will only return a list of nested ids instead of embedding the entire JSON of the nested objects.

For example, to get a user's posts:

GET http://*.*/api/users/1
# => { "users": { "id": 1, "posts": [1, 2, 3] } }

GET http://*.*/api/posts?ids=1,2,3
# => { "posts": [{ "id": 1, "author": 1 }, { "id": 2, "author": 1 }, { "id": 3, "author": 1 }] }