rest - Web API data paging without using OData syntax -


what options in web api indicate returned data paged , there further data available. asp.net web api odata uses syntax similar following:

{     "odata.metadata":"http://myapi.com/api/$metadata#myresource","value":[     {         "id":1,"name":"foo"     },     ...     {         "id":100,"name":"bar"     }    ],"odata.nextlink":"http://myapi.com/api/myresource?$skip=20" } 

are there other ways indicate link next/previous 'page' of data without using metadata wrapper around results. can achieved using custom response headers instead?

let's take step , think webapi. webapi in essence raw data delivery mechanism. it's great making api , elevates separation of concerns pretty height (specifically eliminating ui concerns).

using web api, however, doesn't change core of issue facing. you're asking "how want query data store in performant manner , return data client efficiently?" decisions here parallel same question when building more traditional web app.

as noted, odata 1 method return information. benefit here it's known , defined. body of questions/blogs/articles on topic growing rapidly. wrapper doesn't add meaningful overhead.

yet, odata no means way can this. we've had cope since software has been displaying search results. it's tough give specific advice without understanding scenario. here questions bubbled read question :

  • are results sets huge users see first 1 or 2 pages?
  • or user tend page through of results?
  • are pages of results limited (like 20 or 50 per page) or 100's/ 1000's ?
  • does data set shift rapidly, records added user paging?
  • are result sets short , adding columns repeat tolerable?
  • do have enough control on client do out of band -- custom http headers, or separate http request asks query summary?

there hundreds of options depending on needs. don't know you're using data store, wrote post on getting row count efficiently. issues there germane here, albeit db perspective. might perspective.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -