Response when fetching custom content by type in page is missing data

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:

  1. Install some app that registers a custom content type that we can use for testing, for example draw.io
  2. 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"
  }
}'
  1. 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.

1 Like

Hi @thomas2

Since you’re documenting what you deem a bug can you please raise a bug with ECOHELP? Jira Service Management

Thanks,
Ralph

Hi @thomas2 - thanks for the feedback here. In looks like we made a mistake with this endpoint, putting up a pull request shortly to fix this. Thank you for bring it to our attention!