Hi,
Your application looks cool and planning to implement it in our
company by making rest calls.
We are using Asp.net with c#. I am currently trying to create time
line and events from c#
using rest calls.
The below code is taking me to your web page. How do I get the
TimeLIneID from this.
How do I create events for this and get the eventID's in return????
to create the event- I use
http://www.dipity.com/rest/events...is this
right??
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.Security.Cryptography;
using System.IO;
private void CreateTimeLine()
{
Uri address = new Uri("
http://www.dipity.com/rest/timeline?");
// Create the web request
HttpWebRequest request = WebRequest.Create(address) as
HttpWebRequest;
request.Method = "POST";
request.ContentType = "multipart/form-data";
StringBuilder qstr = new StringBuilder();
qstr.Append("mySecretCode");
qstr.Append("public=1");
qstr.Append("title=Webtest_mytest");
string Hashedval = MD5(qstr.ToString());
//lblHashed.Text = MD5(qstr.ToString());
string getstring = "key=MYAPIKey&sig=" + Hashedval;//
+"&querystring";
byte[] byteData = UTF8Encoding.UTF8.GetBytes(getstring);
request.ContentLength = byteData.Length;
using (Stream postStream = request.GetRequestStream())
{
postStream.Write(byteData, 0, byteData.Length);
}
using (HttpWebResponse response = request.GetResponse() as
HttpWebResponse)
{
//StreamReader reader = new
StreamReader(response.GetResponseStream());
//lblHashed.Text = reader.ReadToEnd();
string str = "status Code:" + response.StatusCode +
response.StatusDescription + response.ProtocolVersion;
lblHashed.Text = str;
}
}
public static string MD5(string password)
{
byte[] textBytes = System.Text.Encoding.Default.GetBytes(password);
try
{
System.Security.Cryptography.MD5CryptoServiceProvider cryptHandler;
cryptHandler = new
System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] hash = cryptHandler.ComputeHash(textBytes);
string ret = "";
foreach (byte a in hash)
{
//if (a < 16)
// ret += "0" + a.ToString("x");
//else
// ret += a.ToString("x");
ret += a.ToString("x2");
}
return ret;
}
catch
{
throw;
}
}