JSON API

The Json API is defined in the SelArom.Net.Sitefinity.API namespace. It is used to present Sitefinity Events and News data in JSON format.

Wrapper Classes

Serialization of data into JSON is done using wrapper classes (EventDetails and NewsDetails) that map their properties to the matching IContent and MetaField values for the Event and News data stored in Sitefinity.

The constructors for these wrapper classes take an IEvent item (for EvendDetails) and IContent item (for News) to initalize their values. Refer to the class implementation for details (code is well-documented).

Collection Classes

These are the primary classes for using the data in the individual Sitefinity Websites. Data is aggregated into these collections, serialized to JSON and cached. On the front-end, the individual Sitefinity websites retrieve the JSON, deserializing it back into these collection classes.

MonthEvents

This is used to hold all of the events taking place within a given month. It is defined as an array of EventDetails where each index represents the day of the month from 1 to 31 (index 0 is not used).

For example, to retreive the events taking place on the 15, you would reference index 15 of the array.

EventList and NewsList

These are simply wrapper classes for a Generic List of content items( (List<EventDetails>' and List<NewsDetails>).

Caching

JSON data is cached to disk for performance using the CacheHelper class. By default, data is cached to the /APP_DATA/API folder. To clear the cache for any website using this API, simply delete this folder from the live web server.

Last edited Feb 25, 2011 at 11:00 PM by SelArom, version 3

Comments

No comments yet.