Ident Engine

A JavaScript library that retrieves and aggregates profiles from across the web

Documentation - User Generated Content

How to retrieve user generated content from public APIs and feeds.

The Identi Engine has the ability to retrieve different types of user generated content. This content is stored in a number of collections ident.entries, ident.events and ident.tags. See demo Lifestream

There are two ways to extract user generated content from the API endpoints discovered by Identi. The findContent method can only be used after a search, whilst the loadContent works independently of the search.

 Option A - Using a search to discover content endpoints

 var doc = jQuery(document);

    doc.ready(function () {
    ident.useInwardEdges = true
    doc.bind('ident:update', loadContent);

    ident.search('http://twitter.com/glennjones');
 });

The code snippet above is using jQuery to create a function which executes as soon as the HTML document is loaded.

Properties

useInwardEdges
The useInwardEdges property controls how the identities are found. If it is set to true it will return a larger sets of results, but there is a greater chance that Identi Engine will return the wrong information about an individual. There will be less of a chance of error if the property is set to false. By default this property is set  to true.

Binding the rendering function

The Identi Engine will update the identities collection a number of times during a single search. To capture the updates we need to bind our own rendering function to the events fired by the library. This can be done easily with jQuery for example:

 doc.bind('ident:update', loadContent);

Once you have found an individual's accounts using the search you can use the findContent function to retrieve content. Any content found by Identi will be stored in the content collections. It will only load content where the search has identified a valid account for the requested domain.

function loadContent(){ 
   ident.findContent('twitter.com', 'Status', 'hAtom' );
   ident.findContent('identi.ca', 'Status', 'hAtom' );  
   ident.findContent('flickr.com', 'Images', 'Atom' ); 
   ident.findContent('del.icio.us', 'Bookmarks', 'Rss'); 
   ident.findContent('upcoming.yahoo.com', 'Events', 'Rss' );
   ident.findContent('last.fm', 'Activity', 'Rss' );
   ident.findContent('ffffound.com', 'Images', 'Rss' );
   ident.findContent('tumblr.com', 'Lifestream', 'Rss' );
   ident.findContent('backtype.com', 'Activity', 'Rss' );
   ident.findContent('vimeo.com', 'Video', 'Rss' );
}

Option B - Direct call to collect content

ident.loadContent( 
  'http://identi.ca/glennjones', 
  'identi.ca', 
  'Identica', 
  'Status', 
  'hAtom' 
);

The loadContent function is straight forward. You need to know a valid account, the content schema and type that are available before making the request. 

Rendering the content collection

ident.entries.sort(ident.sortByDate);
for (var i = 0; i < ident.entries.length; i++) {
   jQuery('<div>' + ident.entries[i]['entry-title'] + '</div>').appendTo( div );
   ...

}

To render the content you need to loop around the collection and retrieve the properties. Each collection has a different set of properties. Please refer to the data structures of each collection; Identity, Profile, Resume, Entry, Event and Tag.

The files that need to be included in the page

There are five files you must include in your HTML for the Identi Engine to retrieve user content.

jquery-1.3.2.min.js
ident-0.1.js
ident-profile-0.1.js
ident-content-0.1.js
ident-yql-parser-0.1.js

Alternatively, you can swap the parser to UfXtract which in some cases will return more results. The UfXtract parser should only be used for low traffic situations.

query-1.3.2.min.js
ident-0.1.js
ident-profile-0.1.js
ident-content-0.1.js
ident-yql-parser-0.1.js
ident-ufxtract-parser-0.1.js

 

To find which combination of domain, content-type and schema are supported please use the debug mapping tool.

Supported domains

Supported content types

Supported schemas