Open link in a new tab

Content

Expand project menu

How do I associate an existing containerless attachment with a work package via API?

The API documentation says:

Clients can create attachments without a container first and attach them later on.

https://docs.openproject.org/api/endpoints/attachments/#attachments-attachments

But I can't find a way to do this.

This not work:

PATCH /api/v3/work_packages/{id}

{
  "lockVersion": 1,
  "_links": {
    "attachments": {
      "href": "/api/v3/attachments/48"
    }
  }
}

How do I associate an existing containerless attachment with a work package via API?

Message actions

Hi Dmitry, 

you need to provide an array for the attachments links as multiple attachments can be provided:

{
  "lockVersion": 1,
  "_links": {
    "attachments": [
      {
        "href": "/api/v3/attachments/48"
      }
    ]
  }
}

Regards,

Jens