Hierarchy

  • CommonHttpService
    • AttachmentService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

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

    Returns AttachmentService

Methods

  • Delete an attachment by id.

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

    Permissions required: Permission to view the container of the attachment. Permission to delete attachments in the space. Permission to administer the space (if attempting to purge).

    Parameters

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

        The ID of the attachment to be deleted.

      • Optionalpurge?: boolean

        If attempting to purge the attachment.

    Returns Promise<void>

    DELETE /attachments/{id} @scopes-current delete:attachment:confluence

  • Returns a specific attachment.

    Permissions required: Permission to view the attachment's container.

    Parameters

    • params: {
          id: string;
          includeCollaborators?: boolean;
          includeLabels?: boolean;
          includeOperations?: boolean;
          includeProperties?: boolean;
          includeVersion?: boolean;
          includeVersions?: boolean;
          version?: number;
      }
      • id: string

        The ID of the attachment to be returned. If you don't know the attachment's ID, use Get attachments for page/blogpost/custom content.

      • OptionalincludeCollaborators?: boolean

        Includes collaborators on the attachment.

      • OptionalincludeLabels?: boolean

        Includes labels associated with this attachment 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 attachment 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 attachment 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 attachment 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 attachment 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.

      • Optionalversion?: number

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

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

    Returned if the requested attachment is returned.

    GET /attachments/{id} @scopes-current read:attachment:confluence

  • Returns all attachments. 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 container of the attachment.

    Parameters

    • params: {
          cursor?: string;
          filename?: string;
          limit?: number;
          mediaType?: string;
          sort?: AttachmentSortOrder;
          status?: ("current" | "archived" | "trashed")[];
      } = {}
      • 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.

      • Optionalfilename?: string

        Filters on the file-name of attachments. Only one may be specified.

      • Optionallimit?: number

        Maximum number of attachments 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.

      • OptionalmediaType?: string

        Filters on the mediaType of attachments. Only one may be specified.

      • Optionalsort?: AttachmentSortOrder

        Used to sort the result by a particular field.

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

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

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

    Returned if the requested attachments are returned.

    GET /attachments @scopes-current read:attachment:confluence

  • Returns the attachments of specific blog post. 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 blog post and its corresponding space.

    Parameters

    • params: {
          cursor?: string;
          filename?: string;
          id: number;
          limit?: number;
          mediaType?: string;
          sort?: AttachmentSortOrder;
          status?: ("current" | "archived" | "trashed")[];
      }
      • 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.

      • Optionalfilename?: string

        Filters on the file-name of attachments. Only one may be specified.

      • id: number

        The ID of the blog post for which attachments should be returned.

      • Optionallimit?: number

        Maximum number of attachments 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.

      • OptionalmediaType?: string

        Filters on the mediaType of attachments. Only one may be specified.

      • Optionalsort?: AttachmentSortOrder

        Used to sort the result by a particular field.

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

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

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

    Returned if the requested attachments are returned.

    GET /blogposts/{id}/attachments @scopes-current read:attachment:confluence

  • Returns the attachments of specific custom content. 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 custom content and its corresponding space.

    Parameters

    • params: {
          cursor?: string;
          filename?: string;
          id: number;
          limit?: number;
          mediaType?: string;
          sort?: AttachmentSortOrder;
          status?: ("current" | "archived" | "trashed")[];
      }
      • 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.

      • Optionalfilename?: string

        Filters on the file-name of attachments. Only one may be specified.

      • id: number

        The ID of the custom content for which attachments should be returned.

      • Optionallimit?: number

        Maximum number of attachments 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.

      • OptionalmediaType?: string

        Filters on the mediaType of attachments. Only one may be specified.

      • Optionalsort?: AttachmentSortOrder

        Used to sort the result by a particular field.

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

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

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

    Returned if the requested attachments are returned.

    GET /custom-content/{id}/attachments @scopes-current read:attachment:confluence

  • Returns the attachments 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 attachment and its corresponding space.

    Parameters

    • params: {
          cursor?: string;
          id: number;
          limit?: number;
          sort?: AttachmentSortOrder;
      }
      • 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 attachments 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?: AttachmentSortOrder

        Used to sort the result by a particular field.

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

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

    GET /labels/{id}/attachments @scopes-current read:attachment:confluence

  • Returns the attachments of specific page. 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: {
          cursor?: string;
          filename?: string;
          id: number;
          limit?: number;
          mediaType?: string;
          sort?: AttachmentSortOrder;
          status?: ("current" | "archived" | "trashed")[];
      }
      • 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.

      • Optionalfilename?: string

        Filters on the file-name of attachments. Only one may be specified.

      • id: number

        The ID of the page for which attachments should be returned.

      • Optionallimit?: number

        Maximum number of attachments 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.

      • OptionalmediaType?: string

        Filters on the mediaType of attachments. Only one may be specified.

      • Optionalsort?: AttachmentSortOrder

        Used to sort the result by a particular field.

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

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

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

    Returned if the requested attachments are returned.

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

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

    Returns void