[racket] Calling Web Service APIs

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri Dec 20 08:37:15 EST 2013

On Fri, Dec 20, 2013 at 2:46 AM, Jens Weber <jens at uvic.ca> wrote:
> Does anybody have a simple example for calling Webservices (REST) with
> racket?

I got tired of the repetitive mechanics of this and made something
called webapi-markdown.

The full idea includes documentation -- that you could do a variation
of "literate programming" where the documentation for a web service
*is* the specification of it. As a web service developer you kill a
few birds with one stone: The spec, the server, and an easy way to
generate client wrappers.

However if you're a user of a web service whose developers weren't
wise enough to use this ;) you can omit the descriptive bits and just
use it as a way to generate wrapper functions.

1. https://github.com/greghendershott/webapi-markdown describes the
file format and has working examples for real services. Note that this
isn't specific to Racket.

2. wffi (web FFI) is a Racket implementation.
Repo: https://github.com/greghendershott/wffi
As a Racket package: `raco pkg install wffi`.

I've actually this to do e.g. a wrapper for the EchoNest service. The code is:
- 95% markdown:
- 2% Racket: https://github.com/greghendershott/echonest/blob/master/echonest/main.rkt
- 3% misc package/project files: https://github.com/greghendershott/echonest

Although this is simple for me to use, I don't know how simple it
would be for you. Maybe there's an opportunity to make something in
the same spirit, but even simpler. Like, a function that you give the
request template and a dictionary of your values.

Posted on the users mailing list.