Add an attachment to a task

Hello!
I’m trying to add an attachment to a specific task but I’m getting this error:
{
“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: Build an app with Asana
}
]
}

Please advise, thanks!

Are you giving the file location? I would suspect the API expect the blob… @Phil_Seeman any idea?

It is possible to test it with Insomenia or I must to create it with Javascript

What is it? :thinking:

A rest api client where you can send http requests, same as Postman

Hi @Asaf,

I can’t tell for sure without seeing your whole request but it looks like you’re trying to pass just a filename. As @Bastien_Siebman says above, you need to pass the binary contents of the file.

You might find these forum posts helpful:

In terms of testing, I’m also not familiar with Insomenia but Asana provides a full collection of samples of their API calls for use in Postman here, including the “Upload an attachment” endpoint:

1 Like

Hey, The problem I’m facing is only attaching a file using Postman/Insomnia for test purposes…

I’ve downloaded the Postman collection but I find that you don’t have this option to attach a file to a task built in… so I still need help over here.

I would very much appreciate it if you can let me know how can it be done…
I also attached 2 images that show that this step is existing on the Documentation but missing on the Postman collection.

Not sure why they organized it this way but it’s in the Postman collection under “Tasks”:

image

Hey, thanks for the help.
But, no matter what I’m trying I’m getting the same error…


When I set clicked on Upload an attachment the value was
I tried to search online Image to Binary convertor but all I tried still getting the same error.
I tried to encode an image to base64 and still the same error.
Please let me know if you find a solution.

Thanks

Thank you for the clarification!