This resource represents system and custom avatars. Use it to obtain the details of system or custom avatars, add and remove avatars from a project, issue type or priority and obtain avatar images.

Hierarchy

  • CommonHttpService
    • AvatarsService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

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

    Returns AvatarsService

Methods

  • Returns a list of system avatar details by owner type, where the owner types are issue type, project, user or priority.

    This operation can be accessed anonymously.

    Permissions required: None.

    Parameters

    • params: {
          type:
              | "priority"
              | "user"
              | "issuetype"
              | "project";
      }
      • type:
            | "priority"
            | "user"
            | "issuetype"
            | "project"

        The avatar type.

    Returns Promise<SystemAvatars>

    Returned if the request is successful.

    example:

    {
    "system": [
    {
    "id": "1000",
    "isDeletable": false,
    "isSelected": false,
    "isSystemAvatar": true,
    "urls": {
    "16x16": "/secure/useravatar?size=xsmall&avatarId=10040&avatarType=project",
    "24x24": "/secure/useravatar?size=small&avatarId=10040&avatarType=project",
    "32x32": "/secure/useravatar?size=medium&avatarId=10040&avatarType=project",
    "48x48": "/secure/useravatar?avatarId=10040&avatarType=project"
    }
    }
    ]
    }

    GET /rest/api/3/avatar/{type}/system @scopes-current manage:jira-configuration @scopes-beta read:avatar:jira

  • Returns a project, issue type or priority avatar image by ID.

    This operation can be accessed anonymously.

    Permissions required:

    • For system avatars, none.
    • For custom project avatars, Browse projects project permission for the project the avatar belongs to.
    • For custom issue type avatars, Browse projects project permission for at least one project the issue type is used in.
    • For priority avatars, none.

    Parameters

    • params: {
          format?: "svg" | "png";
          id: number;
          size?:
              | "small"
              | "medium"
              | "xsmall"
              | "large"
              | "xlarge";
          type: "priority" | "issuetype" | "project";
      }
      • Optionalformat?: "svg" | "png"

        The format to return the avatar image in. If not provided the original content format is returned.

      • id: number

        The ID of the avatar.

      • Optionalsize?:
            | "small"
            | "medium"
            | "xsmall"
            | "large"
            | "xlarge"

        The size of the avatar image. If not provided the default size is returned.

      • type: "priority" | "issuetype" | "project"

        The icon type of the avatar.

    Returns Promise<WithResponse<{
        body: Blob;
        mediaType: "image/svg+xml" | "*/*" | "image/png";
        status: 200;
    } | {
        body: StreamingResponseBody;
        mediaType: "application/json";
        status: 200;
    }>>

    • status: 200, mediaType: * /*

      Returned if the request is successful.

    • status: 200, mediaType: application/json

      Returned if the request is successful.

    • status: 200, mediaType: image/png

      Returned if the request is successful.

    • status: 200, mediaType: image/svg+xml

      Returned if the request is successful.

    GET /rest/api/3/universal_avatar/view/type/{type}/avatar/{id} @scopes-current read:jira-work @scopes-beta read:avatar:jira

  • Returns the avatar image for a project, issue type or priority.

    This operation can be accessed anonymously.

    Permissions required:

    • For system avatars, none.
    • For custom project avatars, Browse projects project permission for the project the avatar belongs to.
    • For custom issue type avatars, Browse projects project permission for at least one project the issue type is used in.
    • For priority avatars, none.

    Parameters

    • params: {
          entityId: string;
          format?: "svg" | "png";
          size?:
              | "small"
              | "medium"
              | "xsmall"
              | "large"
              | "xlarge";
          type: "priority" | "issuetype" | "project";
      }
      • entityId: string

        The ID of the project or issue type the avatar belongs to.

      • Optionalformat?: "svg" | "png"

        The format to return the avatar image in. If not provided the original content format is returned.

      • Optionalsize?:
            | "small"
            | "medium"
            | "xsmall"
            | "large"
            | "xlarge"

        The size of the avatar image. If not provided the default size is returned.

      • type: "priority" | "issuetype" | "project"

        The icon type of the avatar.

    Returns Promise<WithResponse<{
        body: Blob;
        mediaType: "image/svg+xml" | "*/*" | "image/png";
        status: 200;
    } | {
        body: StreamingResponseBody;
        mediaType: "application/json";
        status: 200;
    }>>

    • status: 200, mediaType: * /*

      Returned if the request is successful.

    • status: 200, mediaType: application/json

      Returned if the request is successful.

    • status: 200, mediaType: image/png

      Returned if the request is successful.

    • status: 200, mediaType: image/svg+xml

      Returned if the request is successful.

    GET /rest/api/3/universal_avatar/view/type/{type}/owner/{entityId} @scopes-current read:jira-work @scopes-beta read:avatar:jira

  • Returns the default project, issue type or priority avatar image.

    This operation can be accessed anonymously.

    Permissions required: None.

    Parameters

    • params: {
          format?: "svg" | "png";
          size?:
              | "small"
              | "medium"
              | "xsmall"
              | "large"
              | "xlarge";
          type: "priority" | "issuetype" | "project";
      }
      • Optionalformat?: "svg" | "png"

        The format to return the avatar image in. If not provided the original content format is returned.

      • Optionalsize?:
            | "small"
            | "medium"
            | "xsmall"
            | "large"
            | "xlarge"

        The size of the avatar image. If not provided the default size is returned.

      • type: "priority" | "issuetype" | "project"

        The icon type of the avatar.

    Returns Promise<WithResponse<{
        body: Blob;
        mediaType: "image/svg+xml" | "*/*" | "image/png";
        status: 200;
    } | {
        body: StreamingResponseBody;
        mediaType: "application/json";
        status: 200;
    }>>

    • status: 200, mediaType: * /*

      Returned if the request is successful.

    • status: 200, mediaType: application/json

      Returned if the request is successful.

    • status: 200, mediaType: image/png

      Returned if the request is successful.

    • status: 200, mediaType: image/svg+xml

      Returned if the request is successful.

    GET /rest/api/3/universal_avatar/view/type/{type} @scopes-current read:jira-work @scopes-beta read:avatar:jira

  • Returns the system and custom avatars for a project, issue type or priority.

    This operation can be accessed anonymously.

    Permissions required:

    • for custom project avatars, Browse projects project permission for the project the avatar belongs to.
    • for custom issue type avatars, Browse projects project permission for at least one project the issue type is used in.
    • for system avatars, none.
    • for priority avatars, none.

    Parameters

    • params: {
          entityId: string;
          type: "priority" | "issuetype" | "project";
      }
      • entityId: string

        The ID of the item the avatar is associated with.

      • type: "priority" | "issuetype" | "project"

        The avatar type.

    Returns Promise<Avatars>

    Returned if the request is successful.

    example:

    {
    "custom": [
    {
    "id": "1010",
    "isDeletable": true,
    "isSelected": false,
    "isSystemAvatar": false,
    "urls": {
    "16x16": "https://your-domain.atlassian.net/secure/viewavatar?size=xsmall&avatarId=10080&avatarType=project",
    "24x24": "https://your-domain.atlassian.net/secure/viewavatar?size=small&avatarId=10080&avatarType=project",
    "32x32": "https://your-domain.atlassian.net/secure/viewavatar?size=medium&avatarId=10080&avatarType=project",
    "48x48": "https://your-domain.atlassian.net/secure/viewavatar?avatarId=10080&avatarType=project"
    }
    }
    ],
    "system": [
    {
    "id": "1000",
    "isDeletable": false,
    "isSelected": false,
    "isSystemAvatar": true,
    "urls": {
    "16x16": "https://your-domain.atlassian.net/secure/viewavatar?size=xsmall&avatarId=10040&avatarType=project",
    "24x24": "https://your-domain.atlassian.net/secure/viewavatar?size=small&avatarId=10040&avatarType=project",
    "32x32": "https://your-domain.atlassian.net/secure/viewavatar?size=medium&avatarId=10040&avatarType=project",
    "48x48": "https://your-domain.atlassian.net/secure/viewavatar?avatarId=10040&avatarType=project"
    }
    }
    ]
    }

    GET /rest/api/3/universal_avatar/type/{type}/owner/{entityId} @scopes-current manage:jira-configuration @scopes-beta read:avatar:jira

  • Loads a custom avatar for a project, issue type or priority.

    Specify the avatar's local file location in the body of the request. Also, include the following headers:

    • X-Atlassian-Token: no-check To prevent XSRF protection blocking the request, for more information see Special Headers.
    • Content-Type: image/image type Valid image types are JPEG, GIF, or PNG.

    For example: curl --request POST

    --user email@example.com:<api_token>

    --header 'X-Atlassian-Token: no-check'

    --header 'Content-Type: image/< image_type>'

    --data-binary "<@/path/to/file/with/your/avatar>"

    --url 'https://your-domain.atlassian.net/rest/api/3/universal_avatar/type/{type}/owner/{entityId}'

    The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of the image. The length of the square's sides is set to the smaller of the height or width of the image.

    The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size.

    After creating the avatar use:

    Permissions required: Administer Jira global permission.

    Parameters

    • params: {
          entityId: string;
          mediaType: string;
          requestBody: Blob | Stream;
          size: number;
          type: "priority" | "issuetype" | "project";
          x?: number;
          y?: number;
      }
      • entityId: string

        The ID of the item the avatar is associated with.

      • mediaType: string
      • requestBody: Blob | Stream
      • size: number

        The length of each side of the crop region.

      • type: "priority" | "issuetype" | "project"

        The avatar type.

      • Optionalx?: number

        The X coordinate of the top-left corner of the crop region.

      • Optionaly?: number

        The Y coordinate of the top-left corner of the crop region.

    Returns Promise<Avatar>

    Returned if the request is successful.

    example:

    {
    "id": "1010",
    "isDeletable": true,
    "isSelected": false,
    "isSystemAvatar": false
    }

    POST /rest/api/3/universal_avatar/type/{type}/owner/{entityId} @scopes-current manage:jira-configuration @scopes-beta write:avatar:jira, read:avatar:jira

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

    Returns void