Skip to content

Latest commit

 

History

History
254 lines (191 loc) · 10.2 KB

AvatarsApi.md

File metadata and controls

254 lines (191 loc) · 10.2 KB

AvatarsApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
deleteAvatar DELETE /rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id} Delete avatar
getAllSystemAvatars GET /rest/api/3/avatar/{type}/system Get system avatars by type
getAvatars GET /rest/api/3/universal_avatar/type/{type}/owner/{entityId} Get avatars
storeAvatar POST /rest/api/3/universal_avatar/type/{type}/owner/{entityId} Load avatar

deleteAvatar

deleteAvatar(type, owningObjectId, id)

Delete avatar

Deletes an avatar from a project or issue type. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.AvatarsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

AvatarsApi apiInstance = new AvatarsApi();
String type = "type_example"; // String | The avatar type.
String owningObjectId = "owningObjectId_example"; // String | The ID of the item the avatar is associated with.
Long id = 789L; // Long | The ID of the avatar.
try {
    apiInstance.deleteAvatar(type, owningObjectId, id);
} catch (ApiException e) {
    System.err.println("Exception when calling AvatarsApi#deleteAvatar");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
type String The avatar type. [enum: project, issuetype]
owningObjectId String The ID of the item the avatar is associated with.
id Long The ID of the avatar.

Return type

null (empty response body)

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getAllSystemAvatars

SystemAvatars getAllSystemAvatars(type)

Get system avatars by type

Returns a list of system avatar details by owner type, where the owner types are issue type, project, or user. This operation can be accessed anonymously. Permissions required: None.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.AvatarsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

AvatarsApi apiInstance = new AvatarsApi();
String type = "type_example"; // String | The avatar type.
try {
    SystemAvatars result = apiInstance.getAllSystemAvatars(type);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AvatarsApi#getAllSystemAvatars");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
type String The avatar type. [enum: issuetype, project, user]

Return type

SystemAvatars

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getAvatars

Avatars getAvatars(type, entityId)

Get avatars

Returns the system and custom avatars for a project or issue type. This operation can be accessed anonymously. Permissions required: None.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.AvatarsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

AvatarsApi apiInstance = new AvatarsApi();
String type = "type_example"; // String | The avatar type.
String entityId = "entityId_example"; // String | The ID of the item the avatar is associated with.
try {
    Avatars result = apiInstance.getAvatars(type, entityId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AvatarsApi#getAvatars");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
type String The avatar type. [enum: project, issuetype]
entityId String The ID of the item the avatar is associated with.

Return type

Avatars

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

storeAvatar

Avatar storeAvatar(body, size, type, entityId, x, y)

Load avatar

Loads a custom avatar for a project or issue type. 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 protected]:<api_token> ` `--header 'X-Atlassian-Token: no-check' ` `--header 'Content-Type: image/< image_type>' ` `--data-binary &quot;<@/path/to/file/with/your/avatar>&quot; ` `--url 'https://your-domain.atlassian.net/rest/api/3/universal_avatar/type/{type}/owner/{entityId}&#x27;&#x60; 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: * Update issue type to set it as the issue type's displayed avatar. * Set project avatar to set it as the project's displayed avatar. Permissions required: Administer Jira global permission.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.AvatarsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

AvatarsApi apiInstance = new AvatarsApi();
Object body = null; // Object | 
Integer size = 56; // Integer | The length of each side of the crop region.
String type = "type_example"; // String | The avatar type.
String entityId = "entityId_example"; // String | The ID of the item the avatar is associated with.
Integer x = 0; // Integer | The X coordinate of the top-left corner of the crop region.
Integer y = 0; // Integer | The Y coordinate of the top-left corner of the crop region.
try {
    Avatar result = apiInstance.storeAvatar(body, size, type, entityId, x, y);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AvatarsApi#storeAvatar");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body Object
size Integer The length of each side of the crop region.
type String The avatar type. [enum: project, issuetype]
entityId String The ID of the item the avatar is associated with.
x Integer The X coordinate of the top-left corner of the crop region. [optional] [default to 0]
y Integer The Y coordinate of the top-left corner of the crop region. [optional] [default to 0]

Return type

Avatar

Authorization

OAuth2basicAuth

HTTP request headers

  • Content-Type: /
  • Accept: application/json