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

Pagination API return values #80

Open
zmon opened this issue Jun 19, 2019 · 0 comments
Open

Pagination API return values #80

zmon opened this issue Jun 19, 2019 · 0 comments
Assignees

Comments

@zmon
Copy link
Member

zmon commented Jun 19, 2019

Screen Shot 2019-06-18 at 11 50 29 PM

Screen Shot 2019-06-19 at 12 09 54 AM

The above example is a search for items with 'an' sorted by City in descending order.

The front end would do a GET with a URL of

.../clients?page=1&keyword=an&column=city&direction=1

And return

{  
   "current_page":1,
   "data":[
      {  
         "id":3,
         "name":"Maybell Daniel",
         "address_line_1":"357 Wolff Via Apt. 414",
         "city":"West Lillastad",
         "state":"Hawaii"
      }, 
      {  
         "id":37,
         "name":"Ms. Callie Shanahan",
         "address_line_1":"3010 Cummings Mall",
         "city":"South Robinchester",
         "state":"New Jersey"
      },
      .
      .
      .
   ],
   "first_page_url":"https:\/clients?page=1",
   "from":1,
   "last_page":3,
   "last_page_url":"https:\/...clients?page=3",
   "next_page_url":"https:\/...clients?page=2",
   "path":"https:\/....clients",
   "per_page":10,
   "prev_page_url":null,
   "to":10,
   "total":22
}

URLs are not correct.
We could change the first, last, next, prev _page_url to just be page numbers.

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

No branches or pull requests

3 participants