Paging in the REST-api
Charles Crouch
ccrouch at redhat.com
Wed Feb 20 22:02:57 UTC 2013
Not wishing to complicate matters too much more but have we thought about whether given the dynamic nature of RHQ data whether cursors might be a better option than pagination, at least in some places. Twitter and its stream of tweets (aka alerts/metrics/events) has a good write up: https://dev.twitter.com/docs/working-with-timelines
Cheers
Charles
----- Original Message -----
> FYI, github uses the Link header, too.
>
> http://developer.github.com/v3/#pagination
>
> ----- Original Message -----
> > From: "Heiko W.Rupp" <hrupp at redhat.com>
> > To: rhq-devel at lists.fedorahosted.org
> > Sent: Wednesday, February 20, 2013 10:39:35 AM
> > Subject: Re: Paging in the REST-api
> >
> > To follow up
> >
> > Am 20.02.2013 um 09:11 schrieb Heiko W.Rupp:
> > >
> > > And for parsing I guess in almost all languages other than java,
> > > this can be expressed in two lines :)
> > > But then parsing { 'paging' : [ {
> > > "url":"http://foo...","rel":"next"},{....}]} is not obvious
> > > either.
> > >
> >
> > JAX-RS 2 has a Link object that has a valueOf() method that does
> > this
> > parsing.
> > Javascript has a number of implementations
> >
> > > Pragmatically, the way our REST APIs will be used is primary via
> > > CL/I(javascript) so not having to reach
> > > into the header and parse pagnation data will make much
> > > simpler/powerful integration scripts for our customers (IMO).
> >
> > HATEOAS and REST is also about representation of state in different
> > media types. You mention XML and Json,
> > but there are others - users could also be represented as .jpg
> > images
> > of their avatars. Or as a .vcard. The rest-api could return
> > metrics as a rendered .png or as .svg to be rendered by the client.
> > Or one could return CSV data.
> > Now in CSV how would you add the paging information inside the CSV
> > data? Add them as comment section?
> > Here putting the paging in the header does not alter the body
> > content. And it is the same no matter
> > what content type you have.
> >
> >
> >
> > _______________________________________________
> > rhq-devel mailing list
> > rhq-devel at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/rhq-devel
> >
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/rhq-devel
>
More information about the rhq-devel
mailing list