Confluence Cloud Developer

Confluence Cloud Developer

Rate this page:

Content - macro body

Get macro body by macro ID

GET /wiki/rest/api/content/{id}/history/{version}/macro/id/{macroId}

Returns the body of a macro in storage format, for the given macro ID. This includes information like the name of the macro, the body of the macro, and any macro parameters. This method is mainly used by Cloud apps.

About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for it, unless an ID is specified (by an app). The macro ID will look similar to this: '50884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is only modified by Confluence if there are conflicting IDs.

Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and transparently propagate out to all instances.

Permissions required: Permission to view the content that the macro is in.

App scope requiredREAD

OAuth scopes required
read:confluence-content.all

Request

Path parameters
id Required

string

The ID for the content that contains the macro.

version Required

integer

The version of the content that contains the macro.

Format: int32
macroId Required

string

The ID of the macro. This is usually passed by the app that the macro is in. Otherwise, find the macro ID by querying the desired content and version, then expanding the body in storage format. For example, '/content/196611/version/7?expand=content.body.storage'.

Example

1
2
3
curl --request GET \
  --url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/history/{version}/macro/id/{macroId}' \
  --header 'Accept: application/json'

Responses

Returned if the requested macro body is returned.

Content typeValue
application/json

MacroInstance

Rate this page: