When fetching custom content by type from a page with the corresponding v2 endpoint the response does not contain all the data that the documentation claims it does. Most importantly it does not contain the version
field, which is needed if you want to update the existing content because you need to increment the version number on update.
The workaround would be to do another API call to fetch the custom content by ID, which includes the version field, but that now puts us at 3 API calls just to update a piece of content. I hope that’s just a bug with this endpoint and not how the v2 API is intended to be used in the future.
Steps to reproduce:
- Install some app that registers a custom content type that we can use for testing, for example draw.io
- Create a new custom content object on some page, for example with this curl command (adapt URL, page ID user and API token):
curl --request POST \
--url 'https://<INSTANCE>.atlassian.net/wiki/api/v2/custom-content' \
--user '<USER>:<API_TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"type": "ac:com.mxgraph.confluence.plugins.diagramly:drawio-diagram",
"status": "current",
"pageId": "<PAGE_ID>",
"title": "TEST CUSTOM CONTENT",
"body": {
"representation": "raw",
"value": "CUSTOM CONTENT VALUE"
}
}'
- Fetch the custom content of this type for this page (adapt same data as above):
curl --request GET \
--url 'https://<INSTANCE>.atlassian.net/wiki/api/v2/pages/<PAGE_ID>/custom-content?type=ac:com.mxgraph.confluence.plugins.diagramly:drawio-diagram' \
--user '<USER>:<API_TOKEN>' \
--header 'Accept: application/json'
Expected result:
The response contains the data that is documented in the API docs, including version
, authorId
and createdAt
Actual result:
The response only contains id
, type
, status
, title
, spaceId
and pageId
. The three fields mentioned above are missing.