Calling the API

The API generated by the Iguana API designer is a standard RESTful API.  It does not require special libraries or tools to call.  We’ll start by showing how we can call the API just using built in HTTP primitives in Iguana.  This shows how easily accessible the API is any programming environment that can make HTTP calls and parse JSON.

The API provides good error messages which would allow a programmer to see how they need to call the API correctly:

Because the API designer generates interfaces which have an easy to read JSON grammar, it makes it possible to develop clients in any language that  can:

  • Access the URL of the API server
  • Connect and download the JSON grammar using a _grammar call
  • Parse the grammar and create methods on the fly to connect to the server using the grammar

This greatly reduces the effort required to maintain an API since client code doesn’t need to change if it becomes necessary to exchange new resource types via  the API in the future.

We have written a client in Lua that does this. This video shows how to obtain and use it:

This really shows how easy it is to use these APIs.  A lot of what makes them easy is the predictable nature of JSON which is returned.  The next article explains the design choices here.

Leave A Comment?