Rest

Developer

Phil Sturgeon

3rd Party (Free)

921 downloads (last 90 days)

MIT License Download v1.6.3

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

Add-On Type(s)

Module, Plugin

Tags

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

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

Installation

Move the “rest/” folder inside “system/expressionengine/third_party/”.

Usage

You can create REST requests in the backend module and reference them with Template Syntax, then loop through the returned response. Everything sent back from the API is converted into a loopable ExpressionEngine array wether its XML, JSON, Serialized data, pure PHP, CSV, RSS and Atom feeds. It will even include XML attributes as well as node values so no data is lost.

<ul>
{exp:rest name="foo"}
<li>{some_value}</li>
{/exp:rest}
</ul>

Rest module can do more than just grab information from predefined requests. You can create REST requests on the fly:

{exp:rest url="http://example.com/" verb="get" format="json" param:foo="bar" }
{some_value}<br/>
{/exp:rest}

Parameters

  • name - Name of the saved request

  • id - ID of the saved request

  • record_type - Single or Multiple records?

    • Default: “m”
    • Options: “s” or “m”
  • base - By default you will loop through the top level of the data. Use this to loop through nested arrays.

    • Default: empty
    • Example: data,links
  • limit - Number of results to loop through inside the base element.

    • Default: all
  • offset - Where to start looping

    • Default: all
  • format - What format should the content be encoded in? This sets the Accept HTTP header

    • Default: “xml”
    • Options: “xml”, “atom”, “rss”, “json”, “serialized” or “csv”
  • verb - Also alias “method”, picks which HTTP method to use.

    • Default: “get”
    • Options: “get”, “post”, “put” or “delete”

Parameters can be added even if you call a saved request, it will merge or override params saved in the CP.

Debugging

To debug a request you can add debug=“yes” to the tag.

You could use this syntax with other Template Tags and create some very dynamic flexible sites.

Pagination

{exp:rest url="[some url]" format="xml" limit="16" offset="{global:pagination_offset}" paginate="bottom" base="feed,documents,document"}

    <p class="largey"><a href="{url}" title="{title}">{title}</a><span class="large right">{createDate_mon}/{createDate_day}/{createDate_year}</span></p>

    {paginate}
       <ul class="pagination margin_bottom_04">      
        {previous_page}
            <li><a href="{pagination_url}" title="Previous" class="arrow-prev pager-element">Previous</a></li>
        {/previous_page}

        {page}
            <li><a href="{pagination_url}"class="current">{pagination_page_number}</a></li>
        {/page}

        {next_page}
            <li><a href="{pagination_url}" title="Next" class="arrow-next pager-element">Next</a></li>
        {/next_page}
        </ul>
    {/paginate}

{/exp:rest} 

Changelog

1.6.0
  • Added pagination
  • Added basic documentation in the form of a README
1.5.3
  • CSV fields wrapped with single quotes or no quotes will now work, not just those with double quotes.
  • Supports v2.1.3 changing lang.rest.php to rest_lang.php.
1.5.2
  • Fixed an issue with XML/RSS stripping CDATA.
1.5.1
  • Avoid strtotime on unix timestamps.
  • Hide errors if an invalid base is set, just returns an empty result.
  • Updated Curl library for improved compatibility.
1.5.0
  • Added base=”” tag so you can skip down a few levels. base=“comments,data” is useful for Facebook Graph.
  • Use format=”” to any tag that should be a human readable date, no matter the format that comes from the API.
1.4.0
  • Global Variables can now be passed to parameters. E.g: param:foo=”{bar}”
  • Added limit=”” and offset=”” parameters to help with restricting results.
  • Improved EngineHosting support, i.e no more basedir error messages.
1.3.0
  • Now supports RSS and Atom feeds.
  • Extra params can be added in the template tag to saved requests.
  • Added debug=“yes”.
  • Users running in safe mode (WHY?!) will no longer get PHP errors.

Download Rest

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.6.3 Jun 20, 2013

Rest Links

This entry was created July 2, 2010, 6:07 pm.
This entry was last updated October 24, 2013, 12:05 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

5 Reviews:

johnwbaxter 04.17.15

johnwbaxter
Rating - {addon_rating_average}

This add-on works well in EE 2.7.2 still (consuming XML) which i really wasn’t expecting! Great stuff, cheers Phil ;)

Tyler Willingham 07.09.12

Tyler Willingham
Rating - {addon_rating_average}

Rest did exactly what i needed it to and it was incredibly easy.

One thing to note is that if you’re writing the entire call in your templates the default format is NOT set. So if you’re omitting the format param thinking it will default to XML it will not. Just toss it in there.

Moly Yim 01.01.12

Moly Yim
Rating - {addon_rating_average}

This add-on is a godsend if you need to interact with any type of RESTful API. It opens up an entire world of new possibilities of things you can do with ExpressionEngine. Totally worth the $30.

Dave Brookes 08.30.10

Dave Brookes
Rating - {addon_rating_average}

Jason, If you want links, names and #tags in tweets turned into links use this: http://devot-ee.com/add-ons/tweetify I’m using it with this and it works very well. This add-on doesn’t make assumptions about what you’re making.

Would like more control over caching, then it would get my 5 stars.

Jason Turcotte 08.25.10

Jason Turcotte
Rating - {addon_rating_average}

Purchased this add-on and while it does give you basic output, things like links embedded into Twitter timelines are not converted to links.

Also, linking to screen name is hindered because of a “bug” using tags twice, you really can’t link to user profiles either.

Save your $30 for now.