[racket] Calling Web Service APIs

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Fri Dec 20 03:37:32 EST 2013

Jens, hello.

On 2013 Dec 20, at 07:46, Jens Weber <jens at uvic.ca> wrote:

> Does anybody have a simple example for calling Webservices (REST) with racket?

I have an example of such a thing (if I'm following you correctly) at <https://bitbucket.org/nxg/audiotag> (see src/webserver/audiotag.rkt).  This isn't small, but it's relatively simple in _structure_, and includes stuff to handle the GET/POST/PUT/DELETE which the REST approach is so fond of, plus extra support for things like content negotiation, and helpers for generating *ML from code.

It might also be educational in its weaknesses; this was, I think, one of my first large Racket projects, and so shouldn't be taken to be a paradigm.

In particular: If I were starting this again, I'd be a lot more strict with myself about keeping the main program (audiotag.rkt) small and componentised.  I tried to do that, and have a lot of stuff in separate modules, but clearly didn't try hard enough, and the result still includes a hard-to-refactor big blob of code.

I hope it's interesting.

Best wishes,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



Posted on the users mailing list.