I have an app that calls the Salesforce REST API to retrieve attachments stored in Salesforce. It makes a call like this to get the attachment body:
/services/data/v52.0/sobjects/Attachment/00Pe0000008ELB4EAO/Body
I now need to do the same for an attachment that may or may not be deleted. I can query a deleted attachment like this and get some information about it:
/services/data/v52.0/queryAll/?q=select+body+from+Attachment+where+id='00Pe0000008ELB4EAO'
This returns a body like this -- note this response does not contain the actual file body:
{
"totalSize": 1,
"done": true,
"records": [
{
"attributes": {
"type": "Attachment",
"url": "/services/data/v52.0/sobjects/Attachment/00Pe0000008ELB4EAO"
},
"Body": "/services/data/v52.0/sobjects/Attachment/00Pe0000008ELB4EAO/Body"
}
]
}
But when I call /services/data/v52.0/sobjects/Attachment/00Pe0000008ELB4EAO/Body
, I get a 404 Not Found
status and the following response body:
[
{
"errorCode": "NOT_FOUND",
"message": "The requested resource does not exist"
}
]
Are there any workarounds I can consider?