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;
}
}
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,
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.