-
Notifications
You must be signed in to change notification settings - Fork 0
add_json
timojaask edited this page Jun 29, 2014
·
5 revisions
Add new message to the database.
-
URL:
http://whispr.outi.me/api/add_json - Method: Post
- Arguments: Message object
- Return value: The ID of the new message
##C#
var newMessage = new SkeneMessage() {
Latitude = 60.0,
Longitude = 20.0,
Text = "Hello, Skene!",
PublishTime = 1404066977 // 29.06.2014 @ 18:36 UTC
};
var httpClient = new HttpClient();
var uri = new Uri("http://whispr.outi.me/api/add_json");
var json = JsonConvert.SerializeObject(newMessage);
var content = new StringContent(json);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var response = await httpClient.PostAsync(uri, content);
var result = await response.Content.ReadAsStringAsync();