Hierarchy

  • CommonHttpService
    • PageService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

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

    Returns PageService

Methods

  • Creates a page in the space.

    Pages are created as published by default unless specified as a draft in the status field. If creating a published page, the title must be specified.

    Permissions required: Permission to view the corresponding space. Permission to create a page in the space.

    Parameters

    • params: {
          embedded?: boolean;
          private?: boolean;
          requestBody: {
              body?: PageBodyWrite | PageNestedBodyWrite;
              parentId?: string;
              spaceId: string;
              status?: "current" | "draft";
              subtype?: "live";
              title?: string;
          } & {
              [key: string]: unknown;
          };
          rootLevel?: boolean;
      }
      • Optionalembedded?: boolean

        Tag the content as embedded and content will be created in NCS.

      • Optionalprivate?: boolean

        The page will be private. Only the user who creates this page will have permission to view and edit one.

      • requestBody: {
            body?: PageBodyWrite | PageNestedBodyWrite;
            parentId?: string;
            spaceId: string;
            status?: "current" | "draft";
            subtype?: "live";
            title?: string;
        } & {
            [key: string]: unknown;
        }
      • OptionalrootLevel?: boolean

        The page will be created at the root level of the space (outside the space homepage tree). If true, then a value may not be supplied for the parentId body parameter.

    Returns Promise<PageSingle & {
        _links?: {
            base?: string;
        } & {
            [key: string]: unknown;
        };
    } & {
        [key: string]: unknown;
    }>

    Returned if the page was successfully created.

    POST /pages @scopes-current write:page:confluence

  • Delete a page by id.

    By default this will delete pages that are non-drafts. To delete a page that is a draft, the endpoint must be called on a draft with the following param draft=true. Discarded drafts are not sent to the trash and are permanently deleted.

    Deleting a page moves the page to the trash, where it can be restored later. To permanently delete a page (or "purge" it), the endpoint must be called on a trashed page with the following param purge=true.

    Permissions required: Permission to view the page and its corresponding space. Permission to delete pages in the space. Permission to administer the space (if attempting to purge).

    Parameters

    • params: {
          draft?: boolean;
          id: number;
          purge?: boolean;
      }
      • Optionaldraft?: boolean

        If attempting to delete a page that is a draft.

      • id: number

        The ID of the page to be deleted.

      • Optionalpurge?: boolean

        If attempting to purge the page.

    Returns Promise<void>

    DELETE /pages/{id} @scopes-current delete:page:confluence

  • Returns the pages of specified label. The number of results is limited by the limit parameter and additional results (if available) will be available through the next URL present in the Link response header.

    Permissions required: Permission to view the content of the page and its corresponding space.

    Parameters

    • params: {
          bodyFormat?: PrimaryBodyRepresentation;
          cursor?: string;
          id: number;
          limit?: number;
          sort?: PageSortOrder;
          spaceId?: number[];
      }
      • OptionalbodyFormat?: PrimaryBodyRepresentation

        The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.

      • Optionalcursor?: string

        Used for pagination, this opaque cursor will be returned in the next URL in the Link response header. Use the relative URL in the Link header to retrieve the next set of results.

      • id: number

        The ID of the label for which pages should be returned.

      • Optionallimit?: number

        Maximum number of pages per result to return. If more results exist, use the Link header to retrieve a relative URL that will return the next set of results.

      • Optionalsort?: PageSortOrder

        Used to sort the result by a particular field.

      • OptionalspaceId?: number[]

        Filter the results based on space ids. Multiple space ids can be specified as a comma-separated list.

    Returns Promise<{
        _links?: MultiEntityLinks;
        results?: PageBulk[];
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested pages for specified label were successfully fetched.

    GET /labels/{id}/pages @scopes-current read:page:confluence

  • Returns a specific page.

    Permissions required: Permission to view the page and its corresponding space.

    Parameters

    • params: {
          bodyFormat?: PrimaryBodyRepresentationSingle;
          getDraft?: boolean;
          id: number;
          includeCollaborators?: boolean;
          includeDirectChildren?: boolean;
          includeFavoritedByCurrentUserStatus?: boolean;
          includeLabels?: boolean;
          includeLikes?: boolean;
          includeOperations?: boolean;
          includeProperties?: boolean;
          includeVersion?: boolean;
          includeVersions?: boolean;
          includeWebresources?: boolean;
          status?: (
              | "current"
              | "draft"
              | "archived"
              | "historical"
              | "trashed"
              | "deleted")[];
          version?: number;
      }
      • OptionalbodyFormat?: PrimaryBodyRepresentationSingle

        The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.

      • OptionalgetDraft?: boolean

        Retrieve the draft version of this page.

      • id: number

        The ID of the page to be returned. If you don't know the page ID, use Get pages and filter the results.

      • OptionalincludeCollaborators?: boolean

        Includes collaborators on the page.

      • OptionalincludeDirectChildren?: boolean

        Includes direct children of the page, as defined in the ChildrenResponse object.

      • OptionalincludeFavoritedByCurrentUserStatus?: boolean

        Includes whether this page has been favorited by the current user.

      • OptionalincludeLabels?: boolean

        Includes labels associated with this page in the response. The number of results will be limited to 50 and sorted in the default sort order. A meta and _links property will be present to indicate if more results are available and a link to retrieve the rest of the results.

      • OptionalincludeLikes?: boolean

        Includes likes associated with this page in the response. The number of results will be limited to 50 and sorted in the default sort order. A meta and _links property will be present to indicate if more results are available and a link to retrieve the rest of the results.

      • OptionalincludeOperations?: boolean

        Includes operations associated with this page in the response, as defined in the Operation object. The number of results will be limited to 50 and sorted in the default sort order. A meta and _links property will be present to indicate if more results are available and a link to retrieve the rest of the results.

      • OptionalincludeProperties?: boolean

        Includes content properties associated with this page in the response. The number of results will be limited to 50 and sorted in the default sort order. A meta and _links property will be present to indicate if more results are available and a link to retrieve the rest of the results.

      • OptionalincludeVersion?: boolean

        Includes the current version associated with this page in the response. By default this is included and can be omitted by setting the value to false.

      • OptionalincludeVersions?: boolean

        Includes versions associated with this page in the response. The number of results will be limited to 50 and sorted in the default sort order. A meta and _links property will be present to indicate if more results are available and a link to retrieve the rest of the results.

      • OptionalincludeWebresources?: boolean

        Includes web resources that can be used to render page content on a client.

      • Optionalstatus?: (
            | "current"
            | "draft"
            | "archived"
            | "historical"
            | "trashed"
            | "deleted")[]

        Filter the page being retrieved by its status.

      • Optionalversion?: number

        Allows you to retrieve a previously published version. Specify the previous version's number to retrieve its details.

    Returns Promise<PageSingle & {
        _links?: {
            base?: string;
        } & {
            [key: string]: unknown;
        };
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested page is returned.

    GET /pages/{id} @scopes-current read:page:confluence

  • Returns all pages. The number of results is limited by the limit parameter and additional results (if available) will be available through the next URL present in the Link response header.

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

    Parameters

    • params: {
          bodyFormat?: PrimaryBodyRepresentation;
          cursor?: string;
          id?: number[];
          limit?: number;
          sort?: PageSortOrder;
          spaceId?: number[];
          status?: (
              | "current"
              | "archived"
              | "trashed"
              | "deleted")[];
          subtype?: "page" | "live";
          title?: string;
      } = {}
      • OptionalbodyFormat?: PrimaryBodyRepresentation

        The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.

      • Optionalcursor?: string

        Used for pagination, this opaque cursor will be returned in the next URL in the Link response header. Use the relative URL in the Link header to retrieve the next set of results.

      • Optionalid?: number[]

        Filter the results based on page ids. Multiple page ids can be specified as a comma-separated list.

      • Optionallimit?: number

        Maximum number of pages per result to return. If more results exist, use the Link header to retrieve a relative URL that will return the next set of results.

      • Optionalsort?: PageSortOrder

        Used to sort the result by a particular field.

      • OptionalspaceId?: number[]

        Filter the results based on space ids. Multiple space ids can be specified as a comma-separated list.

      • Optionalstatus?: (
            | "current"
            | "archived"
            | "trashed"
            | "deleted")[]

        Filter the results to pages based on their status. By default, current and archived are used.

      • Optionalsubtype?: "page" | "live"

        Filter the results to pages based on their subtype.

      • Optionaltitle?: string

        Filter the results to pages based on their title.

    Returns Promise<{
        _links?: MultiEntityLinks;
        results?: PageBulk[];
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested pages are returned.

  • Returns all pages in a space. The number of results is limited by the limit parameter and additional results (if available) will be available through the next URL present in the Link response header.

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

    Parameters

    • params: {
          bodyFormat?: PrimaryBodyRepresentation;
          cursor?: string;
          depth?: "all" | "root";
          id: number;
          limit?: number;
          sort?: PageSortOrder;
          status?: (
              | "current"
              | "archived"
              | "trashed"
              | "deleted")[];
          title?: string;
      }
      • OptionalbodyFormat?: PrimaryBodyRepresentation

        The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.

      • Optionalcursor?: string

        Used for pagination, this opaque cursor will be returned in the next URL in the Link response header. Use the relative URL in the Link header to retrieve the next set of results.

      • Optionaldepth?: "all" | "root"

        Filter the results to pages at the root level of the space or to all pages in the space.

      • id: number

        The ID of the space for which pages should be returned.

      • Optionallimit?: number

        Maximum number of pages per result to return. If more results exist, use the Link header to retrieve a relative URL that will return the next set of results.

      • Optionalsort?: PageSortOrder

        Used to sort the result by a particular field.

      • Optionalstatus?: (
            | "current"
            | "archived"
            | "trashed"
            | "deleted")[]

        Filter the results to pages based on their status. By default, current and archived are used.

      • Optionaltitle?: string

        Filter the results to pages based on their title.

    Returns Promise<{
        _links?: MultiEntityLinks;
        results?: PageBulk[];
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested pages are returned.

    GET /spaces/{id}/pages @scopes-current read:page:confluence

  • Update a page by id.

    When the "current" version is updated, the provided body content is considered as the latest version. This latest body content will be attempted to be merged into the draft version through a content reconciliation algorithm. If two versions are significantly diverged, the latest provided content may entirely override what was previously in the draft.

    Permissions required: Permission to view the page and its corresponding space. Permission to update pages in the space.

    Parameters

    • params: {
          id: number;
          requestBody: {
              body: PageBodyWrite | PageNestedBodyWrite;
              id: string;
              ownerId?: unknown;
              parentId?: unknown;
              spaceId?: unknown;
              status: "current" | "draft";
              title: string;
              version: {
                  message?: string;
                  number?: number;
              } & {
                  [key: string]: unknown;
              };
          } & {
              [key: string]: unknown;
          };
      }
      • id: number

        The ID of the page to be updated. If you don't know the page ID, use Get Pages and filter the results.

      • requestBody: {
            body: PageBodyWrite | PageNestedBodyWrite;
            id: string;
            ownerId?: unknown;
            parentId?: unknown;
            spaceId?: unknown;
            status: "current" | "draft";
            title: string;
            version: {
                message?: string;
                number?: number;
            } & {
                [key: string]: unknown;
            };
        } & {
            [key: string]: unknown;
        }

    Returns Promise<PageSingle & {
        _links?: {
            base?: string;
        } & {
            [key: string]: unknown;
        };
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested page is successfully updated.

    PUT /pages/{id} @scopes-current write:page:confluence

  • Updates the title of a specified page.

    Permissions required: Permission to view the page and its corresponding space. Permission to update pages in the space.

    Parameters

    • params: {
          id: number;
          requestBody: {
              status: "current" | "draft";
              title: string;
          } & {
              [key: string]: unknown;
          };
      }
      • id: number

        The ID of the page to be updated. If you don't know the page ID, use Get Pages and filter the results

      • requestBody: {
            status: "current" | "draft";
            title: string;
        } & {
            [key: string]: unknown;
        }

    Returns Promise<PageSingle & {
        _links?: {
            base?: string;
        } & {
            [key: string]: unknown;
        };
    } & {
        [key: string]: unknown;
    }>

    Returned if the requested page is successfully updated.

    PUT /pages/{id}/title @scopes-current write:page:confluence

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

    Returns void