The Add Events API adds events to the LibraryThing Local events system using a simple “RESTful” API.
You can also find this on WikiThing: Add Events API
Come Talk about the API here.
The Request
Each Add Events request consists of a single http request, with all parameters specified in the URL. There is no ganging of requests.
There is no separate API to update events. If the system finds an event for the same venue at the same time and added by you, it replaces it with the new one.
Here is a sample request with the parameters broken out onto separate lines.
http://www.librarything.com/api_eventadd.php?
title=Spring+Author+Series
&description=A+reading+from+Every+Visible+Thing+by+Lisa+Carey.
&isbns=0060937424,0380815591
&time=2012-12-1+11:00
&venue=2427
&userid=timspalding
&developerkey=[omitted]
&addevent=1
You can try out this request [http://www.librarything.com/api/eventadd.php?title=Spring+Author+Series&description=A+reading+from+Every+Visible+Thing+by+Lisa+Carey.&isbns=0060937424,0380815591&time=2012-12-1+11:00&venue=2427&userid=timspalding&developerkey=%5Bomitted%5D&addevent=1 by hitting this URL]. Don’t worry, it won’t add a new event.
Basic parameters
title. The title of the event.
time. The date and time of the event, preferably in the format YYYY-MM-DD HH:MM (eg., 2012-12-01 14:00).
Ideally the HH:MM should be in 24-hour (or “military”) format, although you can also append “AM” or “PM.” All times should be local time; not include timezone data, or it will throw off the time calculation as it attempts to square it with LibraryThing’s timezone.
description. The description of the event. Works and authors should NOT be touchstones in the description.
isbns (optional). A comma-separated list of ISBNs relevant to the entry. LibraryThing uses these to retrieve all potential work titles and author names implicated in the description, and creates touchstones as appropriate.
ISBNs are not only for works, but also for authors. For example, if an author is delivering a talk but not reading from any specific work, referencing one of their ISBNs will still ensure that their name in the description gets turned into a touchstone.
eventurl (optional). URL of the event at the venue’s website.
mediaurl (optional). Archived media of the event (for past events only).
Basic parameters
There are two ways of finding the venue. You must use one or the other.
venue. If you know the LibraryThing venue id, use the venue= parameter.
The LibraryThing venue id is located in venue URLs. For example, [http://www.librarything.com/venue/924/Strand-Bookstore http://www.librarything.com/venue/924/Strand-Bookstore] has the venue id 924.
venuesearchtype, venuesearchdata and venuesearchexact. Using these two parameters you instruct LibraryThing to search for a venue. If exactly one venue is found, it will go ahead and choose it, and add the event. At present there are four venuesearchtype options.
*phone. Searches the venue’s phone number. All non-numbers are ignored (ie., 207-555-1212 is the same as 207.555.1212, etc.).
*twitter. Searches the venue’s Twitter handle, if they have one.
*email. Searches for the email.
*name. Searches the venue name.
venuesearchdata is the search string.
venuesearchexact is whether to do a match on partial searches (ie., “Strand” matching “Strand Bookstore,” “Strand Book Annex,” “The Strand Bookshop,” etc.).
Your information
userid. Your LibraryThing userid (ie., timspalding).
developerkey. Developer key. This can be found at http://www.librarything.com/services/keys.php . If you are not a registered developer, you can sign up and get your developer key in less than a minute.
Making it happen
addevent. To make it add the event, rather than just test the system and see an XML response, set addevent=1. Constructing http requests without addevent is a good way to test out the system.
The Response
Requests to the Add Events API return an XML response, recapitulating the event, reporting on errors or warning and listing the status of “added,” “replaced” or “not added.” The <touchstones>
are lets you see whether your ISBNs were successfully turned into touchstones.
<response>
<status>
<action>replaced</action>
<eventid>305621</eventid>
</status>
<event>
<title>Spring Author Series</title>
<venue>LibraryThing H.Q.</venue>
<date>2012-12-01 11:00 AM</date>
<description>
A reading from [Every Visible Thing] by [[Lisa Carey]].
</description>
<touchstones>
<touchstone>
<text>[Every Visible Thing]</text>
<author>careylisa</author>
<work>3702986</work>
</touchstone>
<touchstone>
<text>[[Lisa Carey]]</text>
<author>careylisa</author>
</touchstone>
</touchstones>
</event>
</response>