API return empty body

Hi All,

I am using Confluence REST API, is it possible to get the content from the wiki?
I can access it but it return empty in body key.

Hello @MohamadAmzar

Yes.

Hello @MohamadAmzar

Yes it is possible to retrieve the body of a Confluence content through the REST API.

By default the /rest/api/content/{id} endpoint returns only some of the fields needed to render dashboards and whatnot.
To extract more content fields through the API, you need to use the expand query parameter as follow : /rest/api/content/{id}?expand=body.storage

You can explore what content fields are available through the API by inspecting the _expandable property in the response.

For example:

`/rest/api/content/12345?expand

 "_expandable": {
    "container": "/rest/api/space/public",
    "metadata": "",
    "restrictions": "/rest/api/content/12345/restriction/byOperation",
    "history": "/rest/api/content/12345/history",
    "body": "",
    "version": "",
    "descendants": "/rest/api/content/12345/descendant",
    "space": "/rest/api/space/public",
    "childTypes": "",
    "operations": "",
    "schedulePublishDate": "",
    "children": "/rest/api/content/12345/child",
    "ancestors": ""
  },

`/rest/api/content/12345?expand=body

  "body": {
    "_expandable": {
      "editor": "",
      "atlas_doc_format": "",
      "view": "",
      "export_view": "",
      "styled_view": "",
      "dynamic": "",
      "storage": "",
      "editor2": "",
      "anonymous_export_view": ""
    }
  },
  "_expandable": {
    "childTypes": "",
    "container": "/rest/api/space/public",
    "metadata": "",
    "operations": "",
    "schedulePublishDate": "",
    "children": "/rest/api/content/12345/child",
    "restrictions": "/rest/api/content/12345/restriction/byOperation",
    "history": "/rest/api/content/12345/history",
    "ancestors": "",
    "version": "",
    "descendants": "/rest/api/content/12345/descendant",
    "space": "/rest/api/space/public"
  },

I would have linked to some documentation, but I don’t have any of it bookmarked

I hope this helps

Hasna
former Confluence person