I’m trying to attach a file to a task in Asana through the C# and I’m getting an error:
{"errors":[{"message":"file: Missing input","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}
The request I’m making has the following format.
static async void GoPost(byte[] image)
{
string ApiKey = "<API_KEY>";
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + ApiKey);
MultipartFormDataContent form = new MultipartFormDataContent("Upload----");
form.Add(new ByteArrayContent(image, 0, image.Length), "profile_pic", "1.png");
HttpResponseMessage response = await httpClient.PostAsync("https://app.asana.com/api/1.0/tasks/<TASK_ID>/attachments", form);
var input = await response.Content.ReadAsStringAsync();
Console.WriteLine(input);
}
Anyone can help?