Customize Your RSS Feeds for Hypersyndication and Mashups
Updated on July 15 - Use the serve.a-widget.com domain for faster feed responses via the Akamai Edge network!
In the classic Widget Builder, your Widgets' design and content were merged into a single management interface and an XML feed that included both display rules and the Widget contents. We've expanded this functionality with the new Affiliate Center, where we've split the functionality into 2 tools:
- A Feed Builder, where you can create, edit, sort, and filter an RSS feed of media, members, and content.
- A Widget Builder, where you can create and design Widget interfaces.
This distinction allows you to create a single RSS feed (or connect to an external feed) and use it to power many Widgets.
You can access the Feed Builder's web-based interface in the Affiliate Center, under the Deploy tab. Simply click the Feeds Beta link and click the blue Create button to start building feeds. When you create RSS feeds within the Feed Builder, it generates a URL with a feed like this:
http://serve.a-widget.com/kickapps/service/getFeed.kickAction?feedId=####&as=####
Because the feed is defined by the feedId variable in the URL, you can change the feed's configuration (sorts and filters) in the Feed Builder and the feed contents will automatically be updated as soon as you save the changes.
Here's a simple example using KickApps-powered RSS feeds and simple PHP to create a dynamic, customized homepage on DubAndReggae.com.
Cool stuff, right? Well, it gets better...
Dynamically generating your feeds
You can also use the new feed URLs to dynamically create a custom outputs and use them on other sites or in mashups. Feeds function as a simple API – because a feed can be configured via simple URL parameters, you can easily create dynamic queries of your community data.
All you need to get started playing with your own community's RSS feeds is a simple base URL (if you have DNS masking enabled, use your DNS-masked domain, though the feeds will load less quickly):
http://serve.a-widget.com/kickapps/service/getFeed.kickAction?as=####
Grab the URL above and replace the "#" symbols with your AS number (you can see it in the URLs of any of your KickApps-powered community pages). You'll see a feed that is set with all of our default parameters, showing the 50 most recent videos, audio tracks, photos, blog posts, and members for your site.
You can customize the feed with these configurable parameters:
| Variable | Values | Description | Is Required |
| as | Your affiliate site ID | Affiliate Site Id | Y |
| sortType | {recent|popular|favorite |rating|commented} | Defines how the results are sorted | N |
| quantity | An integer | Quantity items in a feed; if results are paginated (with the p argument, below), this value determines the number of listings per page | N |
| categories | Any of your categories You can also use category>subcategory to indicatethe subcategory of a specific parent category |
Filters for your media categories (Comma separated) |
N |
| mediaType | {video|audio|photo|blog|mb|tags|user|group} | Filters for specific media and member types (Comma separated) |
N |
| groups | {Multiple group names} | Filters for specific groups (Comma separated) |
N |
| memberHasProfilePhoto | {on|empty_string} | If a member has a profile photo or not | N |
| country | Country Name (Single value) | Countries in the world | N |
| state | State abbreviations (Single Value) | US / Canadian Provinces | N |
| city | City name (Single Value) | N | |
| zipPostalCode | ZIP or Postal Code (Single Value) | N | |
| mediaDesc | One or more search terms | Comma separated search terms | N |
| tags | {Multiple tag values} | 1 or more tags (Comma separated) |
N |
| mediaTitle | One or more media titles | Media Title filter (Comma separated) |
N |
| members | One or more member names | Member filter (Comma separated) |
N |
| adminTags | One or more admin tags | Admin Tags field (Comma separated) |
N |
| fromDate | {MM-dd-yyyy} | Date range: from date | N |
| toDate | {MM-dd-yyyy} | Date range: to date | N |
| forum | A forum title | forum name (Single value) |
N |
| discussion | A discussion title | discussion name (Single value) |
N |
| p | An integer | page to be returned, if feed results are paginated (use with quantity, above) |
N |
Using DubAndReggae as an example, if you wanted to create that list of the 20 most recent videos, you could use this feed URL:
http://community.dubandreggae.com/kickapps/service/getFeed.kickAction?as=5057&mediaType=videos&
sortType=recent&quantity=20
(Note that the site has DNS masking enabled.)
Grab that feed and drop it into an open source JavaScript library such as Magic RSS and it will display on your page. (On the Dub and Reggae site, we experimented with MagpieRSS and SimplePie, 2 freely-available PHP libraries for consuming, parsing, and displaying RSS feeds within a page's HTML code.)
Remember that because you're defining the feed parameters in the URL instead of via a feedId variable, there's no management interface for this feed in the Affiliate Center — you've skipped right over it. If you want to edit this feed's configuration, you should do it directly within the URL.
The best of both worlds
Now that you've seen preconfigured feeds (defined by IDs) and custom feed configurations (defined by URL parameters), let's mix em up! To review, if you create a feed in the Affiliate Center Feed Manager, you'll see a URL that looks like
http://serve.a-widget.com/kickapps/service/getFeed.kickAction?feedId=####&as=####
You can further customize this feed by adding or overriding any parameters you've set within the Feed Builder by simply adding variables to the URL. For example, if you create a feed that only contains your community's most recent videos in the Feed Builder, you could override the settings to show your most recent videos and photos with a new URL, like this:
http://serve.a-widget.com/kickapps/service/getFeed.kickAction?feedId=####&as=####&mediaType=video,photo
You can use this to reconfigure sort orders, number of results, the list goes on and on!
The RSS feed content is generated on the fly per request, so using URL parameters to override a feed's settings won't affect other instances of your RSS feed that share the same feedId.
Some tips for the road
- URL-encode multiword strings within the feed URLs. For instance, if you want to find all media with titles that include "great vid," you'd use mediaTitle=great%20vid (%20 is the URL code for a space).
- If you assign an empty or invalid value to a parameter, we'll simply use the default value for each parameter.
- Some of these parameters won't mix and match. For instance, if you set mediaType to "blog" and filter on a forum, you won't get any results. Groups, Forums, and Discussions are three filters that can limit your options. To get a sense of what's available within each, take a look at the relevant KickApps-powered pages.
- If you set mediaType=tags, you can create a tag cloud (we automatically sort tags by their popularity and always return 50 listings).
- Tired of Member Widgets full of default images? Set memberHasProfilePhoto=on to create a feed of members who have included their profile photos.
- Use the members= argument to create a feed of contributions from one or more special members.
- Use the fromDate and toDate arguments to restrict the feed to only include contributions made within a specific timeframe.
- Don't worry about making a mistake – if you enter an invalid parameter or value, we'll simply ignore it and give you and the result set won't be affected.
- The mediaDesc parameter, added March 21, searches media descriptions and member "about me" and custom question responses.
- You can paginate your feed with then quantity and p arguments, for longer results. If you leave these arguments undeclared then the p value defaults to 1 if it's left blank; the quantity value defaults to 1000. As an example, a feed for the second page of most recent results with 25 results per page would look like this:
http://serve.a-widget.com/kickapps/service/getFeed.kickAction?as=####&quantity=25&p=2
Go to your site and give it a shot. If you find a great use for your community's Feed Builder, let us know on the KickDeveloper message boards – we'd love to hear about how you're using it.
Did you enjoy this tutorial? Have questions, comments, or want to submit one of your own? Contact us at support@kickapps.com.