I am able to create Project / task / attachment fine with Asana API with PHP. Is there a way to create Bold for Emphasis description for task / project ? I could not find that in Asana API. Can someone point me to right direction?
I can confirm that if you send in html_notes instead of notes you will be able to use SOME html tags. The html tags that is valid is not documented, so you will have to test to find working tags.
"html_notes": "<strong>This will be bold in Asana</strong>"
I used the following with success when creating a task within a Workspace and a project. Note that this is using WebRequest in a ASP.NET WebApi (C#). But the Json string should work just fine with your project :)
IMPORTANT: Do not encode the html before POST.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://app.asana.com/api/1.0/tasks");
httpWebRequest.Method = "POST";
httpWebRequest.PreAuthenticate = true;
httpWebRequest.Headers.Add("Authorization", "Bearer <PERSONAL_TOKEN>");
httpWebRequest.ContentType = "application/json";
string json = "{\"data\": {\"workspace\": \"123456789\",\"html_notes\": \"<strong>" + question.Message + "</strong>\",\"name\": \"" + Username + "\",\"projects\": \"123456789\"}}";
using (StreamWriter sw = new StreamWriter(httpWebRequest.GetRequestStream()))
{
sw.Write(json);
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}