-
Notifications
You must be signed in to change notification settings - Fork 0
get_latest
timojaask edited this page Jun 29, 2014
·
4 revisions
Get latest messages from the entire world.
-
URL:
http://whispr.outi.me/api/get_latest
- Method: Get
-
Arguments:
- count: The number of messages to return
- json: If set to 1, the result will be returned as JSON object, otherwise as HTML table
- timestamp: Unix timestamp. If specified, only messages newer or same as the timestamp will be returned
- Return value: List of messages either as JSON or a HTML table
##C#
var client = new HttpClient();
// Convert date and time of the last successful get request to Unix time stamp
// so that we only get messages that game after that time
var lastGetTimeStamp = Utils.DateTimeToUnixTimestamp(lastGet);
// Create the parameters string
var getParameters = string.Format("?json=1×tamp={0}", lastGetTimeStamp);
// Create the final URL
var uri = new Uri("http://whispr.outi.me/api/get_latest" + getParameters);
// Send the request and get a result (JSON string)
var json = await client.GetStringAsync(uri);
// Deserialize the JSON string into a list of SkeneMessage objects
IEnumerable<Message> latestLocalMessages = JsonConvert.DeserializeObject<List<SkeneMessage>>(json);