Hi Team,
I am creating a task using asana api in C# (.NET). However i am getting a error as 404 not found.
Please find the below code.
string workspace = “113577*******3”;
string name = “Hello world”;
string data = "{\"data\": { \"workspace\":\"" + workspace + "\", \"name\":\"" + name + "\"}}";
Log("Asana event start :: " + data);
Log("CreateAsanaTasks :: " + Authorizationkey);
var httpgetasanatask = (HttpWebRequest)WebRequest.Create("https://app.asana.com/api/1.0/tasks");
httpgetasanatask.ContentType = "application/json; charset=UTF-8";
httpgetasanatask.Headers.Add("Authorization", "Bearer *********");
httpgetasanatask.Method = "POST";
httpgetasanatask.Timeout = 5000;
httpgetasanatask.ReadWriteTimeout = 5000;
byte[] dataBytes11 = UTF8Encoding.UTF8.GetBytes(data);
using (Stream postStream = httpgetasanatask.GetRequestStream())
{
postStream.Write(dataBytes11, 0, dataBytes11.Length);
}
HttpWebResponse httpresponse21 = httpgetasanatask.GetResponse() as HttpWebResponse;
var d1 = new StreamReader(httpresponse21.GetResponseStream());