Twitlbl

Twitlbl API

Version 1

Navigation

Methods

Get

A Get request is a request for tag information associated with a tweet.

The Get endpoint is at: http://www.yottashare.com/twitlbl/api/v1/Get.ashx

Request

Get requests support two modes:

  • RESTful mechanism,
  • XmlHttpRequest
RESTful Mechanism

A querystring pair with a name of Id and a value as described below.

XmlHttpRequest

A Get request is a simple xml document posted to the endpoint.

<Get>   <Id></Id> </Get>

Where Id contains the Id of a tweet as assigned by Twitter.

Response

The response to a Get request will be an xml document in the following format:

<Response>   <Id></Id>   <Result></Result>   <Tags>     ...   </Tags>   <Error></Error> </Response>

If the request is successfully processed:

  • The Id node will contain the id of the tweet requested,
  • The Result node will contain Success,
  • The Tags node will contain zero or more tags,
  • The Error node will be empty,

If the request cannot be successfully processed:

  • The Id node may contain the id of the tweet requested,
  • The Result node will contain Failure,
  • The Tags node will contain zero tags,
  • The Error node will contain a message regarding the failure,
C# Sample
private const string TwitlblGetUrl = "http://www.yottashare.com/twitlbl/api/v1/Get.ashx"; public XDocument Get(long id) {   string xml = "<Get><Id>" + id + "</Id></Get>";   byte[] content = System.Text.Encoding.UTF8.GetBytes(xml);   HttpWebRequest request = WebRequest.Create(TwitlblGetUrl) as HttpWebRequest;   request.Method = "POST";   request.ContentType = "application/x-www-form-urlencoded";   request.ContentLength = content.Length;   Stream os = request.GetRequestStream();   os.Write(content, 0, content.Length);   os.Close();   try   {     WebResponse resp = request.GetResponse();     using (XmlReader reader = XmlReader.Create(resp.GetResponseStream()))     {       XDocument doc = XDocument.Load(reader);       return doc;     }   }   catch(Exception ex)   {     System.Diagnostics.Debug.WriteLine(ex.ToString());     throw;   } }

Put

A Put request is a request to publish tag information associated with a tweet.

The Put endpoint is at: http://www.yottashare.com/twitlbl/api/v1/Put.ashx

Request

A Put request is a simple xml document posted to the endpoint.

<Put>   <Id></Id>   <Tags>     <Tag Type="Base">       <Name>Tag</Name>       <Value></Value>     </Tag>   </Tags> </Put>

Where Id contains the Id of a tweet as assigned by Twitter.

Where each Tag in Tags is a tag. A request may contain 1 or more tags. Currently, a value of Base is required for the Type attribute. A Name is required, but currently ignored.

Response

The response to a Put request will be an xml document in the following format:

<Response>   <Id></Id>   <Result></Result>   <Error></Error> </Response>

If the request is successfully processed:

  • The Id node will contain the id of the tweet requested,
  • The Result node will contain Success,
  • The Error node will be empty,

If the request cannot be successfully processed:

  • The Id node may contain the id of the tweet requested,
  • The Result node will contain Failure,
  • The Error node will contain a message regarding the failure,

Structures

Tag

A tag is described by the following structure:

<Tag Type="">   <Name></Name>   <Value></Value> </Tag>

Where Type contains a value from the Tag Type enumeration, and Name contains the Twitlbl assigned name of the tag, and Value contains the tag's value.

Enumerations

Result

  • Failure: Indicates the request could not be fulfilled. Information about the error will be in the Response\Error node.
  • Success: Indicates the request was successfully processed.

Tag Type

  • Base: The tag contains plain-text name/value information.
  • Url: The tag contains url information. The Value node will contain a url.
  • Image: The tag contains image information.
  • UserDefined: The tag contains user-defined values.
  • Bitly: The tag contains a bit.ly shortened url.
  • Trim: The tag contains a tr.im shortened url.
  • GeoTag: The tag contains a geographic location.
  • Semantic: The tag contains a value that is the result of a semantic operation. The Name node will identify the source, the Value node will contain the computed value.
  • TwitterData: The tag contains a name/value pair per the TwitterData specification.
  • ShortenedUrl: The tag contains a shortened url.