[csw-maintainers] Full package statistics via REST

Trygve Laugstøl trygvis at opencsw.org
Mon Oct 31 12:07:31 CET 2011


On 10/28/2011 08:48 AM, Sebastian Kayser wrote:
 > Hey Maciej,
 >
 > * Maciej (Matchek) Blizi??ski<maciej at opencsw.org>  wrote:
 >> If you want to fetch a list of packages from a specific catalog, call
 >> an URL like this one...
 >>
 >> 
http://buildfarm.opencsw.org/pkgdb/rest/catalogs/unstable/sparc/SunOS5.9/
 >>
 >> ...and deserialize JSON.  It takes a while to get that data, so be 
patient.
 >
 > If there's just a single package that I am interested in (I am after the
 > catalogname to md5 mapping), is there a more specific URL to grab? The
 > page above takes really long to load.
 >
 > Btw., can you navigate the REST tree to see which URLs are available?
 > Like an entry page that people can easily remember (or which is added to
 > buildfarm.opencsw.org) and from where one can explore features at will?

The RESTful way to do this is to use a hypermedia. What a hypermedia 
does is to encode how to find the URLs *in* the document. I made one 
practical example [1]. I've tried to match the names used in [2]. Not 
that HTML is a quite restriced hypermedia so it can only generate URLs 
with query parameters and not path segments. If we made our own 
hypermedia we could use URL templates which would be able to generate 
more types of URLs.

Sebastian: if you want to go this way take a look at Mechanize, it's a 
nice library for using forms.

[1]: http://buildfarm.opencsw.org/~trygvis/pkgdb-queries.html
[2]: 
http://sourceforge.net/apps/trac/gar/browser/csw/mgar/gar/v2/lib/web/pkgdb_web.py#L16

-- 
Trygve


More information about the maintainers mailing list