Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API filtering #18

Open
RedTn opened this issue Sep 7, 2017 · 4 comments
Open

API filtering #18

RedTn opened this issue Sep 7, 2017 · 4 comments

Comments

@RedTn
Copy link

RedTn commented Sep 7, 2017

Currently for restaurants, the API needs to be able to support server-side filtering query parameters.

My proposal for the params:

  • ?page[offset] => the page offset
  • ?page[limit] => the limit of items returned per page
  • ?sort => what column to sort on
  • ?desc => sort descending, if this param isnt specified then sort asc

Sample query:

http://asktoni.com/restaurants?page[offset]=1&page[limit]=20&sort=name&desc

@jrhender
Copy link
Collaborator

jrhender commented Sep 8, 2017

Thanks for creating the issue Redmond, I think this should be a top priority.
Why the page[offset] and page[limit] syntax? Is meant to imply some kind of indexing inside of a page data struc? Or is it equivalent to pageOffset and pageLimit?

@RedTn
Copy link
Author

RedTn commented Sep 8, 2017

http://jsonapi.org/format/#fetching-pagination
Suggestion from JSON API format. It's equivalent to what you mentioned.

@jrhender
Copy link
Collaborator

Ok, sounds good, thanks. I propose that go with:
?pageOffset => the page offset
?pageLimit => the limit of items returned per page
to avoid any possible encoding issues https://stackoverflow.com/questions/40568/are-square-brackets-permitted-in-urls, though it's probably not a big deal

@jrhender
Copy link
Collaborator

@wfengk , it looks like you started an "api_filtering" branch already to work on this. Do you want any help with this? Is there somewhere logical for me to hop in and contribute on this filtering stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants