getPageAncestors method

Future<MultiEntityResult<Ancestor>> getPageAncestors({
  1. required int id,
  2. int? limit,
})

Returns all ancestors for a given page by ID in top-to-bottom order (that is, the highest ancestor is the first item in the response payload). The number of results is limited by the limit parameter and additional results (if available) will be available by calling this endpoint with the ID of first ancestor in the response payload.

This endpoint returns minimal information about each ancestor. To fetch more details, use a related endpoint, such as Get page by id.

Permissions required: Permission to access the Confluence site ('Can use' global permission).

Implementation

Future<MultiEntityResult<Ancestor>> getPageAncestors(
    {required int id, int? limit}) async {
  return MultiEntityResult.fromJson(
    await _client.send(
      'get',
      'pages/{id}/ancestors',
      pathParameters: {
        'id': '$id',
      },
      queryParameters: {
        if (limit != null) 'limit': '$limit',
      },
    ),
    reviver: (v) => Ancestor.fromJson(v as Map<String, Object?>),
  );
}