Altering RelayPipe API, Instructions

PLEASE USE THE EXAMPLE SCRIPT FOUND ON: http://listpipe.com/news/relay-pipe-help-center/

The following API instructions are intended to be a guide on modifying the script found on the relay-pipe-help-center page.

RelayPipe™

We have created a dynamic Web Service called ListPipe for Webmasters who want to include our articles into a page on your existing website. The RelayPipe Web Service will only work with websites created with a dynamic programming language such as PHP or ASP.

Your client should have provided you with a RelayPipe Access code, if they have not, either let them know they need to register, or give us (AutoNetTV) a call. Using the REST Web Service, you can create code onto a page on your site that can access your content from our system to display on your page.

If you do not understand dynamic programming languages (such as PHP or ASP) or web services, please tell your client to choose the ‘New Blog’ option in the sign up process.

RelayPipe™ (For Webmasters Only)

RelayPipe is a RESTful system that will serve our content via HTTP protocol, so that developers can easily integrate this content into a dynamic site.

If you are not familiar with REST, visit this page: http://en.wikipedia.org/wiki/Representational_State_Transfer

How RelayPipe Works

RelayPipe creates a handshake between the ListPipe engine and your dynamic website using the REST protocol. Content is stored in your account on the ListPipe system. Your site will display this content by retrieving it from ListPipe and then formatting it to your liking on your site (similar to how your site can display content from a database, although using REST protocol instead of SQL).

We have provided an Example Script in your account to help illustrate the functionality of RelayPipe. To locate the Example Script, login to your account and click on RelayPipe Docs, and search the doc for your link. Notice that the instructions in your control panel are customized with your specific access code for your convenience.

Please understand that this script is simply an example and is NOT A PLUGIN (if you put this Example Script on your site it will most likely not work). We discourage implementing the Example Script directly on your site due to the fact that it is a very simple solution that does not take into consideration the custom or security needs of your site.

Getting Started

You will retrieve your content through a series of HTTP requests to your custom RelayPipe URL.

            The URL for your account is: http://api.listpipe.net/[access]/

The ‘[access]’ part of the URL is your access code, and is generated automatically by the ListPipe system. The access code is how RelayPipe identifies you and authorizes content retrieval.

It is important not to share your access code or post it where it can be found; the access code is the only level of security to prevent other people from connecting to your account and obtaining your content. Your access code is not your account password. If someone learns your access code, they will not be able to access your ListPipe account, but they will be able to access your RelayPipe data.

RelayPipe is designed to be simple. You simply use this URL to send a request to ListPipe, and the RelayPipe will return the requested data as a JSON array. You will open this URL using your programming language of choice and read its contents. For example, when using php, the 'file_get_contents' function is an excellent way to get the contents of the URL and then the 'json_decode' function can be used to convert the contents into an array.

A request will look something like this:

          http://api.listpipe.net/[access]/[Type of Data]/?[Parameters]

You can request four types of data: Posts, Categories, Archives, and a Post Count.

Retrieving Posts

Posts are your content, and contain a unique ID, a title, a post date, a category, and custom content. You can edit your RelayPipe content in the 'Blog Content' section of your control panel after you login.

When retrieving posts, RelayPipe will return an array of associative arrays that look like this:

Array(   [0]=>Array( [post_id]=>integer, [post_date]=>datetime, [title]=>string, [content]=>string, [category_id]=>integer, [category]=>string),   [1]=>Array( [post_id]=>integer, [post_date]=>datetime, [title]=>string, [content]=>string, [category_id]=>integer, [category]=>string),   …,  [X]=>Array( [post_id]=>integer, [post_date]=>datetime, [title]=>string, [content]=>string, [category_id]=>integer, [category]=>string))

Please note that the "category_id" and "category" will only appear when applicable.

A request for post will look like this:

           http://api.listpipe.net/[access]/posts/?[Parameters]

There are 7 optional parameters for retrieving posts. If no parameters are specified RelayPipe will return your most recent 10 posts:

Name

Description

Default

post_id

The unique ID of the Post that you want to retrieve. If this parameter is set, it will override all other parameters. This parameter must be an integer value.

Not Set

category_id

The unique ID of the category of posts that you want to retrieve. This parameter must be an integer value and only one category may be specified per request.

Not Set

start_date

The start date and time for post. When set, RelayPipe will return only post with a post date after the start_date. This parameter may be a timestamp or any well formatted date string (i.e. "May 11, 2010 4:58 PM" or "2010/05/11 16:58:40"”)

Not Set

end_date

The end date for post. When set, RelayPipe will return only post with a post date before the end_date. This parameter may be a timestamp or any well formatted date string (i.e. "May 11, 2010 4:58 PM" or "2010/05/11 16:58:40")

The current date and time

offset

Offset the results by this amount. This parameter must be an integer.

0

limit

The number of results to return. If you want no limit specify "none" for this parameter, otherwise, this parameter expects a positive, non-zero integer.

10

search

A search parameter for the post. When set, RelayPipe will return only post that fit the search parameter (both title and content are searched).

Not Set

Retrieving Categories

Allowing your readers to browse your posts by category is very common on a blog. By retrieving Categories through RelayPipe you can easily construct a list of your post categories for your ListPipe Content (Note that this section is for retrieving a list of categories, not for retrieving posts in a category).

There are no parameters for retrieving categories, as such, when retrieving categories, RelayPipe will return an array of associative arrays that look like this:

Array(   [0]=>Array( [category_id]=>integer, [category_name]=>string, [post_count]=>integer ),

   [1]=>Array( [category_id]=>integer, [category_name]=>string, [post_count]=>integer ),

   …,   [X]=>Array( [category_id]=>integer, [category_name]=>string, [post_count]=>integer ))

A request for categories will look like this:

            http://api.listpipe.net/[access]/category/

Please note that uncategorized posts will appear in the NULL category, so your implementation needs to handle uncategorized posts. For uncategorized posts, you should have an 'IF' statement that defines a category for uncategorized posts.

NOTE: Some of our channels of content include categories while others do not. If you are receiving a channel of content that does not include categories, you will get a NULL value for the category. You can use an 'IF' statement to reassign NULL categories to your chosen category name.

Retrieving Archives

Listing an archive of post is also very common on a blog. As such, RelayPipe provides a way to easily build an archive of your post by retrieving a list of your archives. By retrieving Archives through RelayPipe you can easily construct a list of archives for your ListPipe Content (Again, please note that this section is for retrieving a list of archives, not for retrieving posts in an archive.).

When retrieving archives, RelayPipe will return an array of associative arrays that look like this:

Array(   [0]=>Array( [title]=>string, [start_date]=>datetime, [end_date]=>datetime, [post_count]=>integer ),

   [1]=>Array( [title]=>string, [start_date]=>datetime, [end_date]=>datetime, [post_count]=>integer ),

   …,   [X]=>Array( [title]=>string, [start_date]=>datetime, [end_date]=>datetime, [post_count]=>integer ))

A request for archives will look like this:

            http://api.listpipe.net/[access]/archives/?[Parameters]

There is only one optional parameter for retrieving archives. If this parameter is not specified, RelayPipe will return data for you to construct a monthly list of archives:

Name

Description

Default

interval

The interval of time for each item in the archive list. This parameter must be either “month” or “year”.

month

Retrieving Post Count

If you wish to create pagination on your blog, it is useful to know the total number of posts on your blog. As such RelayPipe provides an easy way to retrieve the total number of posts in your RelayPipe account.

When retrieving the post count, RelayPipe will simply return an numeric value (it is still encoded in JSON).

A request for archives will look like this:

            http://api.listpipe.net/[access]/count/

There are no parameters to specify when retrieving the post count.

The Theory Behind ListPipe

The benefit of using content from ListPipe, other than informational, is to increase the search engine value of your website. When using RelayPipe you will want to do so in a way that maximizes your search engine optimization (SEO).

You do not want your site to simply link to your RelayPipe URL, rather you want your server to read the content from RelayPipe and display only the content from RelayPipe.

If your site simply has a direct link to your RelayPipe URL, not only will this significantly decrease your SEO value, but the content will not be human-readable.

Please give us a call at 801-492-9900 if you have any questions.

©2009 Square Compass, Inc. | DBA ListPipe | All Rights Reserved.