Addon Info

Developer: Phil Sturgeon

License: View

$15.00

Rest

Integrate RESTful API's into your MojoMotor website with this Rest module. You can list Tweets, search for Digg articles, show off Flickr photographs and interact with any open RESTful API.

Overview

Rest is a plugin that allows you to create a request to a RESTful API with Mojo Tags, then loop through the returned response. Everything sent back from the API is converted into a loopable array whether its XML, JSON, Serialized data or CSV. It will even include XML attributes as well as node values.

Example

Create a list Phil Sturgeon's tweets.

<ul>
{mojo:rest:get url="http://api.twitter.com/1/statuses/user_timeline.json" format="json" param:screen_name="philsturgeon"}

  <li><strong>{user}{name}{/user}</strong> - {text}</li>

{/mojo:rest:get}

</ul>

Make other types of request

{mojo:rest:post url="http://example.com/api/update" param:foo="bar"}

{mojo:rest:put url="http://example.com/api/add_something" param:foo="bar"}

{mojo:rest:delete url="http://example.com/delete_something" param:foo="bar"}

You can access the response for post, put and delete the same as get. It all works the same. You can work with pretty much any RESTful API such as Flickr, Digg and YouTube, but you will need to have an understanding of how their API's work. This can be as simple as looking at example feeds or their documentation.