This project is read-only.

Search API Examples

Example of how to search using the API:

            TVersityManager target = new TVersityManager(this.BaseUrl);
            SearchOptions searchOptions = new SearchOptions("Search query");
            searchOptions.StartAt = 0;
            searchOptions.Count = 50;
            SearchResponse response = target.MedialibSearch(searchOptions);

All fields within the SearchOptions object are optional. If non are set, TVersity's default values will be used instead.

To iterate all responses, simply use the ResponseItems list within the SearchResponse object:

            foreach (SearchResponseItem sri in response.ResponseItems)

If you want only the Videos, use the Videos list within the SearchResponse object:
            foreach (SearchVideo smi in response.Videos)
                // etc

All objects other than SearchResponseItem are "lazy-loaded", meaning their data will only be parsed if needed. This improves performance a bit. Note that if an object's XML is improperly sent back from TVersity for whatever reason, you may only get an error when trying to load these other types.

Last edited Aug 1, 2010 at 8:04 PM by ericdunn, version 4


No comments yet.