-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Low
-
1
-
Minor
Issue Summary
Working with an attachment that has a content property, it's important to note that once the attachment is trashed, the content properties become inaccessible through the REST V.2 API.
In contrast, the REST V.1 API allows for the retrieval of content properties from trashed objects using the following endpoint:{}
/wiki/rest/api/content/{contentId}/property/{propertyKey}?status=trashed
Unfortunately, this functionality is not available in the V.2 APIs.
The REST V.2 API call below successfully returns the attachment; however, despite being invoked with include-properties=true, the result does not include the content property.
This behavior seems to be a bug: if the API is not designed to return trashed objects, it should neither return the attachment nor the content property. On the other hand, if trashed objects are intended to be returned, both the attachment and the content property should be included.
/wiki/api/v2/attachments/{attachmentId}?include-properties=true&status=current,archived,trash
When querying directly for all content properties with the REST V.2 API, no results are returned:
/wiki/api/v2/attachments/{attachmentId}/properties?status=trashed
The content property is accessible through the following REST V.2 API; however, constructing the {propertyId} ,segment of the URL is not feasible without first calling the previous two APIs to obtain the propertyId, rendering this approach impractical:
/wiki/api/v2/attachments/{attachmentId}/properties/{propertyId}
This is reproducible on Data Center: NO
Steps to Reproduce
- Create an attachment
- Create a content property on the attachment
- Delete the attachment
- Fetch the content property
Expected Results
Retrieve trashed content properties
Actual Results
No content properties are returned
Workaround
Fetch the attachments property ID
GET /wiki/api/v2/attachments/<attachmentId>/properties
when the attachment is first created, and store it in a DB, then call the
GET /wiki/api/v2/attachments/<attachmentId>/properties/<propertyId>
API to fetch the property ID.