Rate this page:
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.
Connect app scope required: READ
read:content.metadata:confluence
string
The ID for the content that contains the macro.
integer
The version of the content that contains the macro. Specifying 0
as the version
will return
the macro body for the latest content version.
int32
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'.
1 2 3 4 5 6 7 8 9 10 11 12
// This sample uses Atlassian Forge
// https://developer.atlassian.com/platform/forge/
import api, { route } from "@forge/api";
const response = await api.asApp().requestConfluence(route`/wiki/rest/api/content/{id}/history/{version}/macro/id/{macroId}`, {
headers: {
'Accept': 'application/json'
}
});
console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());
Returned if the requested macro body is returned.
Content type | Value |
---|---|
application/json |
Rate this page: