Pull request attachments can be deleted using REST API:
But I am not seeing similar option for the work item attachments:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/attachments?view=azure-devops-rest-7.0
Is there a workaround or some undocumented way to do it using HTTP API?
You need to perform
PATCH
request on work item for removing attachment using Azure DevOps REST API.
I have a work item with attachment as below in my Azure DevOps project:
To delete the work item attachment, I ran PATCH
request with below request body:
PATCH https://dev.azure.com/{orgname}/_apis/wit/workitems/{id}?&api-version=7.0
[
{
"op": "test",
"path": "/rev",
"value": 10
},
{
"op": "remove",
"path": "/relations/0"
}
]
Response:
To confirm that, I checked the same in DevOps portal where work item attachment deleted successfully like below:
Reference: Work Items - Update - REST API | Microsoft