Hierarchy

  • CommonHttpService
    • ContentService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

    • getClientInstance: (() => CommonHttpClient)
        • (): CommonHttpClient
        • Returns CommonHttpClient

    Returns ContentService

Methods

  • Archives a list of pages. The pages to be archived are specified as a list of content IDs. This API accepts the archival request and returns a task ID. The archival process happens asynchronously. Use the /longtask/ REST API to get the copy task status.

    Each content ID needs to resolve to page objects that are not already in an archived state. The content IDs need not belong to the same space.

    Permissions required: 'Archive' permission for each of the pages in the corresponding space it belongs to.

    Parameters

    • params: {
          requestBody: {
              pages?: ({
                  id: number;
              } & {
                  [key: string]: unknown;
              })[];
          } & {
              [key: string]: unknown;
          };
      }
      • requestBody: {
            pages?: ({
                id: number;
            } & {
                [key: string]: unknown;
            })[];
        } & {
            [key: string]: unknown;
        }

        The pages to be archived.

    Returns Promise<LongTask>

    Returned if the archive request has been submitted.

    POST /wiki/rest/api/content/archive @scopes-current write:confluence-content @scopes-beta read:content.metadata:confluence, write:page:confluence

  • Publishes a legacy draft of a page created from a blueprint. Legacy drafts will eventually be removed in favor of shared drafts. For now, this method works the same as Publish shared draft.

    By default, the following objects are expanded: body.storage, history, space, version, ancestors.

    Permissions required: Permission to view the draft and 'Add' permission for the space that the content will be created in.

    Parameters

    • params: {
          contentBlueprintDraft: ContentBlueprintDraft;
          draftId: string;
          expand?: string[];
          status?: string;
      }
      • contentBlueprintDraft: ContentBlueprintDraft
      • draftId: string

        The ID of the draft page that was created from a blueprint. You can find the draftId in the Confluence application by opening the draft page and checking the page URL.

      • Optionalexpand?: string[]

        A multi-value parameter indicating which properties of the content to expand.

        • childTypes.all returns whether the content has attachments, comments, or child pages/whiteboards. Use this if you only need to check whether the content has children of a particular type.
        • childTypes.attachment returns whether the content has attachments.
        • childTypes.comment returns whether the content has comments.
        • childTypes.page returns whether the content has child pages.
        • childTypes.whiteboard returns whether the content has child whiteboards.
        • childTypes.database returns whether the content has child databases.
        • childTypes.embed returns whether the content has child embeds (smartlinks).
        • childTypes.folder returns whether the content has child folders.
        • container returns the space that the content is in. This is the same as the information returned by Get space.
        • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
        • metadata.properties returns content properties that have been set via the Confluence REST API.
        • metadata.labels returns the labels that have been added to the content.
        • metadata.frontend this property is only used by Atlassian.
        • operations returns the operations for the content, which are used when setting permissions.
        • children.page returns pages that are descendants at the level immediately below the content.
        • children.whiteboard returns whiteboards that are descendants at the level immediately below the content.
        • children.database returns databases that are descendants at the level immediately below the content.
        • children.embed returns embeds (smartlinks) that are descendants at the level immediately below the content.
        • children.folder returns folders that are descendants at the level immediately below the content.
        • children.attachment returns all attachments for the content.
        • children.comment returns all comments on the content.
        • restrictions.read.restrictions.user returns the users that have permission to read the content.
        • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
        • restrictions.update.restrictions.user returns the users that have permission to update the content.
        • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
        • history returns the history of the content, including the date it was created.
        • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
        • history.previousVersion returns information about the update prior to the current content update.
        • history.contributors returns all of the users who have contributed to the content.
        • history.nextVersion returns information about the update after to the current content update.
        • ancestors returns the parent content, if the content is a page or whiteboard.
        • body returns the body of the content in different formats, including the editor format, view format, and export format.
        • body.storage returns the body of content in storage format.
        • body.view returns the body of content in view format.
        • version returns information about the most recent update of the content, including who updated it and when it was updated.
        • descendants.page returns pages that are descendants at any level below the content.
        • descendants.whiteboard returns whiteboards that are descendants at any level below the content.
        • descendants.database returns databases that are descendants at any level below the content.
        • descendants.embed returns embeds (smartlinks) that are descendants at any level below the content.
        • descendants.folder returns folders that are descendants at any level below the content.
        • descendants.attachment returns all attachments for the content, same as children.attachment.
        • descendants.comment returns all comments on the content, same as children.comment.
        • space returns the space that the content is in. This is the same as the information returned by Get space.

        In addition, the following comment-specific expansions can be used:

        • extensions.inlineProperties returns inline comment-specific properties.
        • extensions.resolution returns the resolution status of each comment.
      • Optionalstatus?: string

        The status of the content to be updated, i.e. the draft. This is set to 'draft' by default, so you shouldn't need to specify it.

    Returns Promise<null | Content>

    Returned if the draft was successfully published.

    POST /wiki/rest/api/content/blueprint/instance/{draftId} @scopes-current write:confluence-content @scopes-beta read:content-details:confluence, write:content:confluence

  • Publishes a shared draft of a page created from a blueprint.

    By default, the following objects are expanded: body.storage, history, space, version, ancestors.

    Permissions required: Permission to view the draft and 'Add' permission for the space that the content will be created in.

    Parameters

    • params: {
          contentBlueprintDraft: ContentBlueprintDraft;
          draftId: string;
          expand?: string[];
          status?: string;
      }
      • contentBlueprintDraft: ContentBlueprintDraft
      • draftId: string

        The ID of the draft page that was created from a blueprint. You can find the draftId in the Confluence application by opening the draft page and checking the page URL.

      • Optionalexpand?: string[]

        A multi-value parameter indicating which properties of the content to expand.

        • childTypes.all returns whether the content has attachments, comments, or child pages/whiteboards. Use this if you only need to check whether the content has children of a particular type.
        • childTypes.attachment returns whether the content has attachments.
        • childTypes.comment returns whether the content has comments.
        • childTypes.page returns whether the content has child pages.
        • childTypes.whiteboard returns whether the content has child whiteboards.
        • childTypes.database returns whether the content has child databases.
        • childTypes.embed returns whether the content has child embeds (smartlinks).
        • childTypes.folder returns whether the content has child folders.
        • container returns the space that the content is in. This is the same as the information returned by Get space.
        • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
        • metadata.properties returns content properties that have been set via the Confluence REST API.
        • metadata.labels returns the labels that have been added to the content.
        • metadata.frontend this property is only used by Atlassian.
        • operations returns the operations for the content, which are used when setting permissions.
        • children.page returns pages that are descendants at the level immediately below the content.
        • children.whiteboard returns whiteboards that are descendants at the level immediately below the content.
        • children.database returns databases that are descendants at the level immediately below the content.
        • children.embed returns embeds (smartlinks) that are descendants at the level immediately below the content.
        • children.folder returns folders that are descendants at the level immediately below the content.
        • children.attachment returns all attachments for the content.
        • children.comment returns all comments on the content.
        • restrictions.read.restrictions.user returns the users that have permission to read the content.
        • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
        • restrictions.update.restrictions.user returns the users that have permission to update the content.
        • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
        • history returns the history of the content, including the date it was created.
        • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
        • history.previousVersion returns information about the update prior to the current content update.
        • history.contributors returns all of the users who have contributed to the content.
        • history.nextVersion returns information about the update after to the current content update.
        • ancestors returns the parent content, if the content is a page or whiteboard.
        • body returns the body of the content in different formats, including the editor format, view format, and export format.
        • body.storage returns the body of content in storage format.
        • body.view returns the body of content in view format.
        • version returns information about the most recent update of the content, including who updated it and when it was updated.
        • descendants.page returns pages that are descendants at any level below the content.
        • descendants.whiteboard returns whiteboards that are descendants at any level below the content.
        • descendants.database returns databases that are descendants at any level below the content.
        • descendants.embed returns embeds (smartlinks) that are descendants at any level below the content.
        • descendants.folder returns folders that are descendants at any level below the content.
        • descendants.attachment returns all attachments for the content, same as children.attachment.
        • descendants.comment returns all comments on the content, same as children.comment.
        • space returns the space that the content is in. This is the same as the information returned by Get space.

        In addition, the following comment-specific expansions can be used:

        • extensions.inlineProperties returns inline comment-specific properties.
        • extensions.resolution returns the resolution status of each comment.
      • Optionalstatus?: string

        The status of the content to be updated, i.e. the draft. This is set to 'draft' by default, so you shouldn't need to specify it.

    Returns Promise<null | Content>

    Returned if the draft was successfully published.

    PUT /wiki/rest/api/content/blueprint/instance/{draftId} @scopes-current write:confluence-content @scopes-beta read:content-details:confluence, write:content:confluence

  • Returns the list of content that matches a Confluence Query Language (CQL) query. For information on CQL, see: Advanced searching using CQL.

    Example initial call:

    /wiki/rest/api/content/search?cql=type=page&limit=25
    

    Example response:

    {
    "results": [
    { ... },
    { ... },
    ...
    { ... }
    ],
    "limit": 25,
    "size": 25,
    ...
    "_links": {
    "base": "<url>",
    "context": "<url>",
    "next":
    "/rest/api/content/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg",
    "self": "<url>"
    }
    }

    When additional results are available, returns next and prev URLs to retrieve them in subsequent calls. The URLs each contain a cursor that points to the appropriate set of results. Use limit to specify the number of results returned in each call. Example subsequent call (taken from example response):

    /wiki/rest/api/content/search?cql=type=page&limit=25&cursor=raNDoMsTRiNg
    

    The response to this will have a prev URL similar to the next in the example response.

    If the expand query parameter is used with the body.export_view and/or body.styled_view properties, then the query limit parameter will be restricted to a maximum value of 25.

    Permissions required: Permission to access the Confluence site ('Can use' global permission). Only content that the user has permission to view will be returned.

    Parameters

    • params: {
          cql: string;
          cqlcontext?: string;
          cursor?: string;
          expand?: string[];
          limit?: number;
      }
      • cql: string

        The CQL string that is used to find the requested content.

      • Optionalcqlcontext?: string

        The space, content, and content status to execute the search against. Specify this as an object with the following properties:

        • spaceKey Key of the space to search against. Optional.
        • contentId ID of the content to search against. Optional. Must be in the space spacified by spaceKey.
        • contentStatuses Content statuses to search against. Optional.
      • Optionalcursor?: string

        Pointer to a set of search results, returned as part of the next or prev URL from the previous search call.

      • Optionalexpand?: string[]

        A multi-value parameter indicating which properties of the content to expand.

        • childTypes.all returns whether the content has attachments, comments, or child pages/whiteboards. Use this if you only need to check whether the content has children of a particular type.
        • childTypes.attachment returns whether the content has attachments.
        • childTypes.comment returns whether the content has comments.
        • childTypes.page returns whether the content has child pages.
        • childTypes.whiteboard returns whether the content has child whiteboards.
        • childTypes.database returns whether the content has child databases.
        • childTypes.embed returns whether the content has child embeds (smartlinks).
        • childTypes.folder returns whether the content has child folders.
        • container returns the space that the content is in. This is the same as the information returned by Get space.
        • metadata.currentuser returns information about the current user in relation to the content, including when they last viewed it, modified it, contributed to it, or added it as a favorite.
        • metadata.properties returns content properties that have been set via the Confluence REST API.
        • metadata.labels returns the labels that have been added to the content.
        • metadata.frontend this property is only used by Atlassian.
        • operations returns the operations for the content, which are used when setting permissions.
        • children.page returns pages that are descendants at the level immediately below the content.
        • children.whiteboard returns whiteboards that are descendants at the level immediately below the content.
        • children.database returns databases that are descendants at the level immediately below the content.
        • children.embed returns embeds (smartlinks) that are descendants at the level immediately below the content.
        • children.folder returns folders that are descendants at the level immediately below the content.
        • children.attachment returns all attachments for the content.
        • children.comment returns all comments on the content.
        • restrictions.read.restrictions.user returns the users that have permission to read the content.
        • restrictions.read.restrictions.group returns the groups that have permission to read the content. Note that this may return deleted groups, because deleting a group doesn't remove associated restrictions.
        • restrictions.update.restrictions.user returns the users that have permission to update the content.
        • restrictions.update.restrictions.group returns the groups that have permission to update the content. Note that this may return deleted groups because deleting a group doesn't remove associated restrictions.
        • history returns the history of the content, including the date it was created.
        • history.lastUpdated returns information about the most recent update of the content, including who updated it and when it was updated.
        • history.previousVersion returns information about the update prior to the current content update.
        • history.contributors returns all of the users who have contributed to the content.
        • history.nextVersion returns information about the update after to the current content update.
        • ancestors returns the parent content, if the content is a page or whiteboard.
        • body returns the body of the content in different formats, including the editor format, view format, and export format.
        • body.storage returns the body of content in storage format.
        • body.view returns the body of content in view format.
        • version returns information about the most recent update of the content, including who updated it and when it was updated.
        • descendants.page returns pages that are descendants at any level below the content.
        • descendants.whiteboard returns whiteboards that are descendants at any level below the content.
        • descendants.database returns databases that are descendants at any level below the content.
        • descendants.embed returns embeds (smartlinks) that are descendants at any level below the content.
        • descendants.folder returns folders that are descendants at any level below the content.
        • descendants.attachment returns all attachments for the content, same as children.attachment.
        • descendants.comment returns all comments on the content, same as children.comment.
        • space returns the space that the content is in. This is the same as the information returned by Get space.

        In addition, the following comment-specific expansions can be used:

        • extensions.inlineProperties returns inline comment-specific properties.
        • extensions.resolution returns the resolution status of each comment.
      • Optionallimit?: number

        The maximum number of content objects to return per page. Note, this may be restricted by fixed system limits.

    Returns Promise<ContentArray>

    Returned if the requested list of content is returned.

    GET /wiki/rest/api/content/search @scopes-current search:confluence @scopes-beta read:content-details:confluence

  • Method to initialize the class. Normally used to set up validation rules.

    Returns void