{
errors: [
{
message: 'file: File is not an object',
help: 'For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors'
}
]
}
If I change the name of form data, from ‘file’ to ‘File’ it cause an error message “File: Missing Input”. Even adding the quotes to the name like ‘"file"’ does not make it work. I have read all the forum posts on the subject and unfortunately no one has helped me. I would be very grateful if someone would help!
Hello Jana, I did it from apps script to import a GSheets as a pdf file into an Asana task with blob object.
This link was usefull, I hope it can help you : Uploading attachment from blob plus parent parameter
For all those who have the same problem as me - here are two things that made my code work:
first, the object must be created with the class constructor (jsut say this because i often see people creating these form as js objects). In addition, the base64 string must be entered as a blob in the from data, thanks @Dorian.J for this hint!
const formData = new FormData();
formData.append('file', blob, validAttachment.filename);
Then (unlike described in the developer api documentation) the name parameter must be omitted (in case the base64 string is transferred via the request and the file is not loaded from the filesystem). Rather, the filename must be specified as part of the form field (as you can see above)
Content = base64 string and content type = image/png
Furthermore the parent must be appended as form field too. The following request did not throw an error, but also did not append the image to the task.