public class

IssueTypeResource

extends Object
java.lang.Object
   ↳ com.atlassian.jira.rest.v2.issue.IssueTypeResource

Summary

Public Constructors
IssueTypeResource(JiraAuthenticationContext authContext, ContextUriInfo contextUriInfo, JiraBaseUrls jiraBaseUrls, IssueTypeService issueTypeService, I18nHelper i18n, XsrfInvocationChecker xsrfChecker, AvatarResourceHelper avatarResourceHelper, GlobalPermissionManager globalPermissionManager, ResponseFactory responseFactory)
Public Methods
Response createAvatarFromTemporary(String issueTypeId, AvatarCroppingBean croppingInstructions)
Converts temporary avatar into a real avatar
Response createIssueType(IssueTypeCreateBean issueTypeCreateBean)
Creates an issue type from a JSON representation and adds the issue newly created issue type to the default issue type scheme.@return
Response deleteIssueType(String issueTypeId, String alternativeIssueTypeId)
Deletes the specified issue type.
Response getAlternativeIssueTypes(String issueTypeId)
Returns a list of all alternative issue types for the given issue type id.
Response getIssueAllTypes()
Returns a list of all issue types visible to the user
Response getIssueType(String issueTypeId)
Returns a full representation of the issue type that has the given id.
Response storeTemporaryAvatar(String issueTypeId, String filename, Long size, HttpServletRequest request)
Creates temporary avatar.
Response storeTemporaryAvatarUsingMultiPart(String issueTypeId, FilePart filePart, HttpServletRequest request)
Creates temporary avatar using multipart.
Response updateIssueType(String issueTypeId, IssueTypeUpdateBean issueTypeUpdateBean)
Updates the specified issue type from a JSON representation.@return
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public IssueTypeResource (JiraAuthenticationContext authContext, ContextUriInfo contextUriInfo, JiraBaseUrls jiraBaseUrls, IssueTypeService issueTypeService, I18nHelper i18n, XsrfInvocationChecker xsrfChecker, AvatarResourceHelper avatarResourceHelper, GlobalPermissionManager globalPermissionManager, ResponseFactory responseFactory)

Public Methods

public Response createAvatarFromTemporary (String issueTypeId, AvatarCroppingBean croppingInstructions)

Converts temporary avatar into a real avatar

Parameters
issueTypeId the id of the issue type, which avatar is updated.
croppingInstructions cropping instructions
Returns
  • created avatar

public Response createIssueType (IssueTypeCreateBean issueTypeCreateBean)

Creates an issue type from a JSON representation and adds the issue newly created issue type to the default issue type scheme.@return

public Response deleteIssueType (String issueTypeId, String alternativeIssueTypeId)

Deletes the specified issue type. If the issue type has any associated issues, these issues will be migrated to the alternative issue type specified in the parameter. You can determine the alternative issue types by calling the /rest/api/2/issuetype/{id}/alternatives resource.

Parameters
issueTypeId the id of the issue type to remove.
alternativeIssueTypeId the id of an issue type to which issues associated with the removed issue type will be migrated.

public Response getAlternativeIssueTypes (String issueTypeId)

Returns a list of all alternative issue types for the given issue type id. The list will contain these issues types, to which issues assigned to the given issue type can be migrated. The suitable alternatives are issue types which are assigned to the same workflow, the same field configuration and the same screen scheme.

Returns
  • a list of issue types

public Response getIssueAllTypes ()

Returns a list of all issue types visible to the user

Returns
  • a list of issue types

public Response getIssueType (String issueTypeId)

Returns a full representation of the issue type that has the given id.

Parameters
issueTypeId a String containing an issue type id
Returns
  • a full representation of the issue type with the given id

public Response storeTemporaryAvatar (String issueTypeId, String filename, Long size, HttpServletRequest request)

Creates temporary avatar. Creating a temporary avatar is part of a 3-step process in uploading a new avatar for an issue type: upload, crop, confirm.

The following examples shows these three steps using curl. The cookies (session) need to be preserved between requests, hence the use of -b and -c. The id created in step 2 needs to be passed to step 3 (you can simply pass the whole response of step 2 as the request of step 3).

 curl -c cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \
   -H "Content-Type: image/png" --data-binary @mynewavatar.png \
   'http://localhost:8090/jira/rest/api/2/issuetype/1/avatar/temporary?filename=mynewavatar.png'

 curl -b cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \
   -H "Content-Type: application/json" --data '{"cropperWidth": "65","cropperOffsetX": "10","cropperOffsetY": "16"}' \
   -o tmpid.json \
   http://localhost:8090/jira/rest/api/2/issuetype/1/avatar

 curl -b cookiejar.txt -X PUT -u admin:admin -H "X-Atlassian-Token: no-check" \
   -H "Content-Type: application/json" --data-binary @tmpid.json \
   http://localhost:8090/jira/rest/api/2/issuetype/1/avatar
 

Parameters
issueTypeId the id of the issue type, which avatar is updated.
filename name of file being uploaded
size size of file
request servlet request
Returns
  • temporary avatar cropping instructions

public Response storeTemporaryAvatarUsingMultiPart (String issueTypeId, FilePart filePart, HttpServletRequest request)

Creates temporary avatar using multipart. The response is sent back as JSON stored in a textarea. This is because the client uses remote iframing to submit avatars using multipart. So we must send them a valid HTML page back from which the client parses the JSON from.

Creating a temporary avatar is part of a 3-step process in uploading a new avatar for an issue type: upload, crop, confirm. This endpoint allows you to use a multipart upload instead of sending the image directly as the request body.

You *must* use "avatar" as the name of the upload parameter:

 curl -c cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \
   -F "avatar=@mynewavatar.png;type=image/png" \
   'http://localhost:8090/jira/rest/api/2/issuetype/1/avatar/temporary'
 

Parameters
issueTypeId the id of the issue type, which avatar is updated.
request servlet request
Returns
  • temporary avatar cropping instructions

public Response updateIssueType (String issueTypeId, IssueTypeUpdateBean issueTypeUpdateBean)

Updates the specified issue type from a JSON representation.@return

Parameters
issueTypeId the id of the issue type to update.