asana-api

How to Delete attachment in Asana trough API


I have started implementing Asana APIs in my project where I create tasks in a particular project through API and then I add attachments to particular ask using through API,

However, I struggle in the case where I need to replace the attachment with a new one, the asana documentation for attachment does not provide a description for any API that can delete/replace an attachment directly neither the edit task API has this option enter image description here

So How do I replace(or at least delete so that I can upload a new one), What is the best alternative way?


Solution

  • I got the answer from Asana Community forum by Frederic_Malenfant stating that

    It looks like the “new documentation” is missing that information!

    But, the old one has, and you should send a “DELETE” to the attachment ID, like: DELETE /api/1.1/attachments/123456789 You don’t need to specify the task, just the document ID.

    and I tried the DELETE API and it works

    DELETE https://app.asana.com/api/1.1/attachments/:attachment_id

    Somehow, the updated documentation is the missing description for the Delete attachment API despite the existence of the API.

    Nevertheless,
    The response for this delete API is quite weird, it replies empty object with key "data" in response as below

    {
      "data": {}
    }