getMacroBodyByMacroId method

Future<MacroInstance> getMacroBodyByMacroId({
  1. required String id,
  2. required int version,
  3. required String 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.

Implementation

Future<MacroInstance> getMacroBodyByMacroId(
    {required String id,
    required int version,
    required String macroId}) async {
  return MacroInstance.fromJson(await _client.send(
    'get',
    'wiki/rest/api/content/{id}/history/{version}/macro/id/{macroId}',
    pathParameters: {
      'id': id,
      'version': '$version',
      'macroId': macroId,
    },
  ));
}