This resource represents avatars associated with a project. Use it to get, load, set, and remove project avatars.

Hierarchy

  • CommonHttpService
    • ProjectAvatarsService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

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

    Returns ProjectAvatarsService

Methods

  • Loads an avatar for a project.

    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/project/{projectIdOrKey}/avatar2'

    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 Set project avatar to set it as the project's displayed avatar.

    Permissions required: Administer projects project permission.

    Parameters

    • params: {
          mediaType: string;
          projectIdOrKey: string;
          requestBody: unknown;
          size?: number;
          x?: number;
          y?: number;
      }
      • mediaType: string
      • projectIdOrKey: string

        The ID or (case-sensitive) key of the project.

      • requestBody: unknown
      • Optionalsize?: number

        The length of each side of the crop region.

      • 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/project/{projectIdOrKey}/avatar2 @scopes-current manage:jira-project @scopes-beta write:project.avatar:jira, read:avatar:jira

  • Returns all project avatars, grouped by system and custom avatars.

    This operation can be accessed anonymously.

    Permissions required: Browse projects project permission for the project.

    Parameters

    • params: {
          projectIdOrKey: string;
      }
      • projectIdOrKey: string

        The ID or (case-sensitive) key of the project.

    Returns Promise<ProjectAvatars>

    Returned if 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/project/{projectIdOrKey}/avatars @scopes-current read:jira-work @scopes-beta read:project.avatar:jira, read:avatar:jira

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

    Returns void