Home » Categories » Multiple Categories

Creating XML-RSS Feeds

Creating XML/RSS feeds:

This is an example of the path to the XML feed file:
http://demo.evanced.info/events/lib/eventsxml.asp
"eventsxml.asp" is the standard name of that file.

To show events that will take place in a specific branch, on the thirtieth day from today, we do this:
http://demo.evanced.info/events/lib/eventsxml.asp?lib=1&do=30
where "lib=1" stands for the library, "do=30" stands for date offset.

And if you want it in RSS mode rather than XML, do this:
http://demo.evanced.info/events/lib/eventsxml.asp?lib=1&do=30&dm=rss2
where "dm" stands for Data Mode.

 


Including System Wide Events in XML/RSS feeds

In some cases, you may need to create feeds that display System-Wide events. These events, which have no specific branch location, will always be included by adding the switch lib=ALL or alternately the ln=999 switch. For branch specific feeds, however, System-Wide events will not appear because they don't exist for any particular branch's schedule. For create a branch specific feed that also includes System-wide event, use two 'ln' switches in combination, setting the first to ln=x. The 'x' in this case stands for the branch ID number. Follow this with an '&' and ln=999, for all-branches. This combination will include both the branch-specific events, and the System-wide events.

For example: http://demo.evanced.info/events/lib/eventsxml.asp?ln=2&ln=999

Note this will not work using the lib= switch.

The switches (everything after "?") tell the system what to display and how to display it. The table below provides a reference for deciphering the switches.

lib =

This is used to control the events for a given library/branch or events for all branches [Default is 0]. Use the library number (lib=x) or "ALL” (lib=ALL) to specify the library’s events that are to be displayed. Note that ALL needs to be in all capital letters.

[Path to event calendar]/eventsxml.asp?lib=1
IncludeDateHtml = 1 This works in HTML mode only and returns a date, so you can plug this into the widget for multi-day stuff.
loc =

This allows you to put in a location and display all events occuring at locations with that phrase in the name. If you do not specify branch, this will return all locations with a name that matches what you enter.

[Path to event calendar]/eventsxml.asp?loc=meeting room A&lib=1
do =

This is the date offset used to return events held X number of days away from today’s date [Default is 0; today’s date] [Path to event calendar]/eventsxml.asp?lib=all&do=1

This URL will bring the events of tomorrow.
alltime =

This is used to display all event times, even events that have already occured earlier in the day. Use alltime=1 to override the default setting.

[Path to event calendar]/eventsxml.asp?lib=1&alltime=1
nd =

Shows the events for the next XX number of days. [Default is 1]. [Path to event calendar]/eventsxml.asp?lib=all&nd=7

This URL shows events for the next 7 days starting TODAY.
startdate= & enddate=

Those are used to specify a date range to pull events from. Date should be in this format: MM/DD/YYYY.

[Path event calendar]/eventsxml.asp?lib=all&startdate=03/07/2010&enddate=03/20/2010
et =

This is used to limit the output to only certain event types. The default is to show all event types. You can specify multiple event types by separating them with a comma and a plus sign (et=Adult+Program,+Book+Discussion). Event types need to be alphabetically in order to work.

[Path event calendar]/eventsxml.asp?lib=all&nd=14&et=Adult+Programs
fe = Refers to Featured Events. Use fe=1 to show only featured events.
ag = This is used to limit the output to only events for certain age groups. Similar to "et" above, you can specify multiple age groups by separating them with a comma and a plus sign (ag=children,+adult).
kw =

This is used to limit output to only events which contain a given keyword in their title, description, other information, or instructor fields. The default is to show all events.

[Path event calendar]/eventsxml.asp?lib=all&nd=30&kw=knitting
dm =

This is used to output using a different XML format. Valid values are "xml" to use the XML format described above, "exml" provides detailed information beyond typical XML mode, "rss2" to output a RSS 2.0 feed, "atom1" to output an ATOM 1.0 feed, and "ical" for iCalendar formatted output for use in other calendar programs like Google calendar. And "html" for HTML page output.

[Default value is "xml"].

[Path to event calendar]/eventsxml.asp?lib=all&nd=7&dm=rss2
roominfo = 1 = shows room reservations information in the rss feed
ongoing =

0 = [Default] Doesn't show ongoing events 1 = shows ongoing events

2 = shows only ongoing events
pub =

Ongoing events will be listed first, if any.

 

0 = [Default] Only shows events published to the public. 1 = shows both published & unpublished

2 = shows only unpublished
private =

0 = [Default] Only shows public events. 1 = shows both public & private events. 2 = shows only private events.

A private event is an event that is either created on a private branch or has a private event type.
feedtitle =

Title that shows at the top of the feed. Used with RSS only. [Default] Upcoming library events.

Advanced Encoding Switches (World Language Compatability)
noencode =

1 = This prevents the system encoding extended characters into their equivalent hex values. This setting works with ISO-8859-1 type of encoding.

Testing with UTF-8 type of encoding generated XML errors.
encodetype = This allows for setting the encoding type in the XML header:
return =

This sets the return path that will be used by the "Back" button on the event detail page. This parameter should be the last in line and needs all "&" characters encoded in hex (%26). This is especially useful when setting up an RSS Feed Reader. To setup an iGoogle RSS feed to display only 'Adult Programs' events from lib=2 but to return to lib=All with all event types when they hit the "Back" button use:

[Path event calendar]/eventsxml.asp?lib=2&nd=5&et=Adult+Programs&return=[Path event calendar]/eventcalendar.asp?et=ALL%26Lib=ALL
limit=xxx

This is used when you need to pre-set the number (xxx) of events returned by the feed. Example:

[Path event calendar]/eventsxml.asp?nd=5&et=Adult+Programs&Lib=ALL&limit=10
rsslink=

This is used to set the link associated with the RSS feed title. This feature is only applicable using RSS and only in some browsers. Example:

[Path event calendar]/eventsxml.asp?dm=rss2&rsslink=http://google.com
IncludeHtmlEndTime = 1 This works in HTML mode only and displays the end time of an event after the start time of the event.
eventid= Pull in a specific event ID number.

Note: There are common switches between these and Calendar view switches, such as: ag, et, and kw.

 

Custom Fields
  • Applicable To: All Users
  • Attachments: No
  • Summary: This article will teach you how to customize your Events XML/RSS feeds with url switches.
5 (1)
Article Rating (1 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Comments (3) Comments
Comment by Neil Michalares on Tue, Dec 10th, 2013 at 12:58 PM
Sorry Anthony, the feed is intended to be read by javascript or RSS readers, so we want to keep it in proper XML/RSS format. If you're consuming the feed via a service, I would recommend getting a count on the results, or reading the XML Object's length.
Comment by Anthony on Fri, Dec 6th, 2013 at 11:55 AM
Is there a way to have the feed return a message when there are no events scheduled? Something like "No events at this time"?
Comment by Nita on Tue, Apr 2nd, 2013 at 2:36 PM
I love this feed and have been using it for years all through my website. It is great that you made so many different switches available, especially "alltime" switch. We have more than one branch and I love use this switch to so it the events are uptodate. However, if the patrons are not on time, they won‘t be aware of the event and also the staff who depends on these pages. It would be nice if the program uses the end time to pull down the event instead of matching it with system time.Thank you for considering and also providing switches.~ NitaNaperville Public Library
Related Articles
Events Search Widget
Viewed 4685 times since Tue, Jan 3, 2012
How To Events-Include a link to a calendar on my website
Viewed 13494 times since Tue, Sep 27, 2011
Events Tiny Calendar Widget
Viewed 25050 times since Tue, Jan 3, 2012
How To Events-Create a custom calendar view
Viewed 14660 times since Tue, Sep 27, 2011
How to Manage Event Registration and Attendance
Viewed 4162 times since Thu, Oct 6, 2011
Events-Client Side XML Example
Viewed 14633 times since Tue, Sep 27, 2011
Events List Widget
Viewed 27973 times since Tue, Jan 3, 2012
Maintaining Event Attendance
Viewed 3397 times since Thu, Oct 6, 2011
How to add a logo or website header to my calendar page
Viewed 29693 times since Tue, Sep 27, 2011