Class IssueResource

java.lang.Object
com.atlassian.jira.rest.v2.issue.IssueResource

@Path("issue") @Consumes("application/json") @Produces("application/json") public class IssueResource extends Object
Since:
v4.2
  • Constructor Details

  • Method Details

    • getTransitions

      @GET @Path("{issueIdOrKey}/transitions") public javax.ws.rs.core.Response getTransitions(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("transitionId") String transitionId)
      Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
      Parameters:
      issueIdOrKey - the issue whose transitions you want to view
      Returns:
      a response containing a Map of TransitionFieldBeans for each transition possible by the current user.
    • getIssuePickerResource

      @Path("picker") @GET public javax.ws.rs.core.Response getIssuePickerResource(@QueryParam("query") String query, @QueryParam("currentJQL") String currentJQL, @QueryParam("currentIssueKey") String currentIssueKey, @QueryParam("currentProjectId") String currentProjectId, @QueryParam("showSubTasks") boolean showSubTasks, @QueryParam("showSubTaskParent") boolean showSubTaskParent)
      Returns suggested issues which match the auto-completion query for the user which executes this request. This REST method will check the user's history and the user's browsing context and select this issues, which match the query.
      Parameters:
      query - the query.
      currentJQL - the JQL in context of which the request is executed. Only issues which match this JQL query will be included in results.
      currentIssueKey - the key of the issue in context of which the request is executed. The issue which is in context will not be included in the auto-completion result, even if it matches the query.
      currentProjectId - the id of the project in context of which the request is executed. Suggested issues will be only from this project.
      showSubTasks - if set to false, subtasks will not be included in the list.
      showSubTaskParent - if set to false and request is executed in context of a subtask, the parent issue will not be included in the auto-completion result, even if it matches the query.
    • doTransition

      @POST @Path("{issueIdOrKey}/transitions") public javax.ws.rs.core.Response doTransition(@PathParam("issueIdOrKey") String issueIdOrKey, IssueUpdateBean issueUpdateBean)
      Perform a transition on an issue. When performing the transition you can update or set other issue fields.
      Parameters:
      issueIdOrKey - the issue you want to transition
      issueUpdateBean - The json containing the transition to perform and which field values to update.
    • removeVote

      @DELETE @Path("{issueIdOrKey}/votes") public javax.ws.rs.core.Response removeVote(@PathParam("issueIdOrKey") String issueIdOrKey)
      Remove your vote from an issue. (i.e. "unvote")
      Parameters:
      issueIdOrKey - the issue the current user is unvoting on
      Returns:
      a Response containing either NO_CONTENT or an error message. the user is the reporter, voting is disabled, the issue does not exist, etc.)
    • addVote

      @POST @Path("{issueIdOrKey}/votes") public javax.ws.rs.core.Response addVote(@PathParam("issueIdOrKey") String issueIdOrKey)
      Cast your vote in favour of an issue.
      Parameters:
      issueIdOrKey - the issue to vote for
      Returns:
      a Response containing NO_CONTENT or an error message
    • getVotes

      @GET @Path("{issueIdOrKey}/votes") public javax.ws.rs.core.Response getVotes(@PathParam("issueIdOrKey") String issueIdOrKey)
      A REST sub-resource representing the voters on the issue.
      Parameters:
      issueIdOrKey - the issue to view voting information for
      Returns:
      a Response containing a VoteBean
    • getIssue

      @GET @Path("{issueIdOrKey}") public javax.ws.rs.core.Response getIssue(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("fields") List<StringList> fields, @QueryParam("expand") String expand, @QueryParam("properties") List<StringList> properties, @QueryParam("updateHistory") boolean updateHistory)
      Returns a full representation of the issue for the given issue key.
      Parameters:
      issueIdOrKey - the issue id or key to request (i.e. JRA-1330)
      fields - the list of fields to return for the issue. By default, all fields are returned.
      properties - the list of properties to return for the issue. By default, no properties are returned.
      Returns:
      a Response containing a IssueBean
    • getIssueWatchers

      @GET @Path("{issueIdOrKey}/watchers") public javax.ws.rs.core.Response getIssueWatchers(@PathParam("issueIdOrKey") String issueIdOrKey)
      Returns the list of watchers for the issue with the given key.
      Parameters:
      issueIdOrKey - the issue key to request (i.e. JRA-1330)
      Returns:
      a Response containing a WatchersBean
    • addWatcher

      @POST @Path("{issueIdOrKey}/watchers") public javax.ws.rs.core.Response addWatcher(@PathParam("issueIdOrKey") String issueIdOrKey, String userName)
      Adds a user to an issue's watcher list.
      Parameters:
      issueIdOrKey - a String containing an issue key
      userName - the name of the user to add to the watcher list. If no name is specified, the current user is added.
      Returns:
      nothing
    • removeWatcher

      @DELETE @Path("{issueIdOrKey}/watchers") public javax.ws.rs.core.Response removeWatcher(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("username") String userName)
      Removes a user from an issue's watcher list.
      Parameters:
      issueIdOrKey - a String containing an issue key.
      userName - a String containing the name of the user to remove from the watcher list. Must not be null.
      Returns:
      a 204 HTTP status if everything goes well
    • createIssue

      @POST public javax.ws.rs.core.Response createIssue(@QueryParam("updateHistory") @DefaultValue("false") boolean updateHistory, IssueUpdateBean createRequest)
      Creates an issue or a sub-task from a JSON representation.
      Parameters:
      updateHistory - if true then the user's project history is updated
      createRequest - an issue create request
      Returns:
      an com.atlassian.jira.rest.api.issue.IssueCreateResponse
    • createIssues

      @POST @Path("/bulk") public javax.ws.rs.core.Response createIssues(IssuesUpdateBean createRequest)
      Creates issues or sub-tasks from a JSON representation.
      Parameters:
      createRequest - IssuesUpdateBean which wraps issues to create in collection of IssueUpdateBean}
      Returns:
      an com.atlassian.jira.rest.api.issue.IssueCreateResponse which encapsulates information about created issues and/or errors
    • deleteIssue

      @DELETE @Path("{issueIdOrKey}") public javax.ws.rs.core.Response deleteIssue(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("deleteSubtasks") String deleteSubtasks)
      Delete an issue. If the issue has subtasks you must set the parameter deleteSubtasks=true to delete the issue. You cannot delete an issue without its subtasks also being deleted.
      Parameters:
      issueIdOrKey - a String containing an issue id or key
      deleteSubtasks - a String of true or false indicating that any subtasks should also be deleted. If the issue has no subtasks this parameter is ignored. If the issue has subtasks and this parameter is missing or false, then the issue will not be deleted and an error will be returned.
      Returns:
      a 204 HTTP status if everything goes well
    • archiveIssue

      @PUT @Path("{issueIdOrKey}/archive") public javax.ws.rs.core.Response archiveIssue(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("notifyUsers") @DefaultValue("true") boolean notifyUsers)
      Archives an issue.
      Parameters:
      issueIdOrKey - Issue id or issue key
      notifyUsers - send the email with notification that the issue was updated to users that watch it. Admin or project admin permissions are required to disable the notification.
      Returns:
      no content response
    • archiveIssues

      @POST @Path("archive") @Produces("text/plain") public javax.ws.rs.core.Response archiveIssues(@RequestBody List<String> issueKeys, @QueryParam("notifyUsers") @DefaultValue("false") boolean notifyUsers)
      Archives a list of issues.
      Parameters:
      issueKeys - List of issue keys
      notifyUsers - send the email with notification that the issue was updated to users that watch it. Admin or project admin permissions are required to disable the notification.
      Returns:
      stream of issues archiving results
    • restoreIssue

      @PUT @Path("{issueIdOrKey}/restore") public javax.ws.rs.core.Response restoreIssue(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("notifyUsers") @DefaultValue("true") boolean notifyUsers)
      Restores an archived issue.
      Parameters:
      issueIdOrKey - Issue id or issue key
      notifyUsers - send the email with notification that the issue was updated to users that watch it. Admin or project admin permissions are required to disable the notification.
      Returns:
      no content response
    • getCreateIssueMetaProjectIssueTypes

      @GET @Path("createmeta/{projectIdOrKey}/issuetypes") public javax.ws.rs.core.Response getCreateIssueMetaProjectIssueTypes(@PathParam("projectIdOrKey") String projectIdOrKey, @QueryParam("startAt") @DefaultValue("0") long startAt, @QueryParam("maxResults") @DefaultValue("50") int maxResults)
      Returns the metadata for issue types used for creating issues. Data will not be returned if the user does not have permission to create issues in that project.
      Parameters:
      projectIdOrKey - to get metadata for
      startAt - the page offset, if not specified then defaults to 0
      maxResults - how many results on the page should be included. Defaults to 50.
      Returns:
      a Response containing a CreateMetaIssueTypeBean
    • getCreateIssueMetaFields

      @GET @Path("createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}") public javax.ws.rs.core.Response getCreateIssueMetaFields(@PathParam("projectIdOrKey") String projectIdOrKey, @PathParam("issueTypeId") String issueTypeId, @QueryParam("startAt") @DefaultValue("0") long startAt, @QueryParam("maxResults") @DefaultValue("50") int maxResults)
      Returns the metadata for issue types used for creating issues. Data will not be returned if the user does not have permission to create issues in that project.
      Parameters:
      projectIdOrKey - to get metadata for
      issueTypeId - to get metadata for
      startAt - the page offset, if not specified then defaults to 0
      maxResults - how many results on the page should be included. Defaults to 50.
      Returns:
      a Response containing a FieldMetaBean
    • getEditIssueMeta

      @GET @Path("{issueIdOrKey}/editmeta") public javax.ws.rs.core.Response getEditIssueMeta(@PathParam("issueIdOrKey") String issueIdOrKey)
      Returns the meta data for editing an issue.

      The fields in the editmeta correspond to the fields in the edit screen for the issue. Fields not in the screen will not be in the editmeta.

      Parameters:
      issueIdOrKey - the issue whose edit meta data you want to view
      Returns:
      a response containing a Map of FieldBeans for fields editable by the current user.
    • editIssue

      @PUT @Path("{issueIdOrKey}") public javax.ws.rs.core.Response editIssue(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("notifyUsers") @DefaultValue("true") boolean notifyUsers, IssueUpdateBean updateRequest)
      Edits an issue from a JSON representation.

      The issue can either be updated by setting explicit the field value(s) or by using an operation to change the field value.

      The fields that can be updated, in either the fields parameter or the update parameter, can be determined using the /rest/api/2/issue/{issueIdOrKey}/editmeta resource.
      If a field is not configured to appear on the edit screen, then it will not be in the editmeta, and a field validation error will occur if it is submitted.

      Specifying a "field_id": field_value in the "fields" is a shorthand for a "set" operation in the "update" section.
      Field should appear either in "fields" or "update", not in both.

      Parameters:
      issueIdOrKey - the issue id or key to update (i.e. JRA-1330)
      notifyUsers - send the email with notification that the issue was updated to users that watch it. Admin or project admin permissions are required to disable the notification.
    • assign

      @PUT @Path("{issueIdOrKey}/assignee") public javax.ws.rs.core.Response assign(@PathParam("issueIdOrKey") String issueIdOrKey, UserBean assigneeBean)
      Assigns an issue to a user. You can use this resource to assign issues when the user submitting the request has the assign permission but not the edit issue permission. If the name is "-1" automatic assignee is used. A null name will remove the assignee.
      Parameters:
      issueIdOrKey - a String containing an issue key
      assigneeBean - A UserBean with the name of the user to assign the issue to.
      Returns:
      nothing
    • getRemoteIssueLinks

      @GET @Path("{issueIdOrKey}/remotelink") public javax.ws.rs.core.Response getRemoteIssueLinks(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("globalId") String globalId)
      A REST sub-resource representing the remote issue links on the issue.
      Parameters:
      issueIdOrKey - the issue to view the remote issue links for
      globalId - The id of the remote issue link to be returned. If null (not provided) all remote links for the issue are returned.

      For a fullexplanation of Issue Link fields please refer to https://developer.atlassian.com/display/JIRADEV/Fields+in+Remote+Issue+Links

      Returns:
      if no globalId is specified, a Response containing a List of RemoteIssueLinkBeans is returned. Otherwise, a Response containing a RemoteIssueLinkBean with the given globalId is returned.
    • getRemoteIssueLinkById

      @GET @Path("{issueIdOrKey}/remotelink/{linkId}") public javax.ws.rs.core.Response getRemoteIssueLinkById(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("linkId") String linkId)
      Get the remote issue link with the given id on the issue.
      Parameters:
      issueIdOrKey - the issue to view the remote issue links for
      linkId - the id of the remote issue link
      Returns:
      a Response containing a RemoteIssueLinkBean.
    • createOrUpdateRemoteIssueLink

      @POST @Path("{issueIdOrKey}/remotelink") public javax.ws.rs.core.Response createOrUpdateRemoteIssueLink(@PathParam("issueIdOrKey") String issueIdOrKey, RemoteIssueLinkCreateOrUpdateRequest request)
      Creates or updates a remote issue link from a JSON representation. If a globalId is provided and a remote issue link exists with that globalId, the remote issue link is updated. Otherwise, the remote issue link is created.
      Parameters:
      issueIdOrKey - the issue to create the remote issue link for
      request - a request to create or update a remote issue link
      Returns:
      a RemoteIssueLinkCreateOrUpdateResponse is disabled.
    • createReciprocalRemoteIssueLink

      @POST @Path("remotelink/reciprocal") public javax.ws.rs.core.Response createReciprocalRemoteIssueLink(RemoteReciprocalIssueLinkCreateRequest request) throws Exception
      Throws:
      Exception
    • updateRemoteIssueLink

      @PUT @Path("{issueIdOrKey}/remotelink/{linkId}") public javax.ws.rs.core.Response updateRemoteIssueLink(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("linkId") String linkId, RemoteIssueLinkCreateOrUpdateRequest updateRequest)
      Updates a remote issue link from a JSON representation. Any fields not provided are set to null.
      Parameters:
      issueIdOrKey - the issue to update the remote issue link for
      updateRequest - a request to update a remote issue link
      Returns:
      a Response containing either NO_CONTENT or an error message.
    • deleteRemoteIssueLinkById

      @DELETE @Path("{issueIdOrKey}/remotelink/{linkId}") public javax.ws.rs.core.Response deleteRemoteIssueLinkById(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("linkId") String remoteIssueLinkId)
      Delete the remote issue link with the given id on the issue.
      Parameters:
      issueIdOrKey - the issue to create the remote issue link for
      remoteIssueLinkId - the id of the remote issue link
      Returns:
      a 204 HTTP status if everything goes well, otherwise the Response contains the error details
    • deleteRemoteIssueLinkByGlobalId

      @DELETE @Path("{issueIdOrKey}/remotelink") public javax.ws.rs.core.Response deleteRemoteIssueLinkByGlobalId(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("globalId") String globalId)
      Delete the remote issue link with the given global id on the issue.
      Parameters:
      issueIdOrKey - the issue to create the remote issue link for
      globalId - the global id of the remote issue link
      Returns:
      a 204 HTTP status if everything goes well, otherwise the Response contains the error details
    • getIssueWorklog

      @GET @Path("{issueIdOrKey}/worklog") public javax.ws.rs.core.Response getIssueWorklog(@PathParam("issueIdOrKey") String issueIdOrKey)
      Returns all work logs for an issue.
      Note: Work logs won't be returned if the Log work field is hidden for the project.
      Parameters:
      issueIdOrKey - the worklogs belongs to
      Returns:
      All worklogs for the issue
    • getWorklog

      @GET @Path("{issueIdOrKey}/worklog/{id}") public javax.ws.rs.core.Response getWorklog(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String worklogId)
      Returns a specific worklog.
      Note: The work log won't be returned if the Log work field is hidden for the project.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the worklog belongs to
      worklogId - a String containing the work log id
      Returns:
      a worklog
    • updateWorklog

      @PUT @Path("{issueIdOrKey}/worklog/{id}") public javax.ws.rs.core.Response updateWorklog(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String worklogId, @QueryParam("adjustEstimate") String adjustEstimate, @QueryParam("newEstimate") String newEstimate, WorklogJsonBean request)
      Updates an existing worklog entry.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the worklog belongs to
      worklogId - id of the worklog to be updated
      adjustEstimate - (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
      • "new" - sets the estimate to a specific value
      • "leave"- leaves the estimate as is
      • "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
      newEstimate - (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field.
      Returns:
      updated worklog
    • deleteWorklog

      @DELETE @Path("{issueIdOrKey}/worklog/{id}") public javax.ws.rs.core.Response deleteWorklog(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String worklogId, @QueryParam("adjustEstimate") String adjustEstimate, @QueryParam("newEstimate") String newEstimate, @QueryParam("increaseBy") String increaseBy)
      Deletes an existing worklog entry.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the worklog belongs to
      worklogId - id of the worklog to be deleted
      adjustEstimate - (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
      • "new" - sets the estimate to a specific value
      • "leave"- leaves the estimate as is
      • "manual" - specify a specific amount to increase remaining estimate by
      • "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
      newEstimate - (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"
      increaseBy - (required when "manual" is selected for adjustEstimate) the amount to increase the remaining estimate by e.g. "2d"
      Returns:
      No Content Response
    • addWorklog

      @POST @Path("{issueIdOrKey}/worklog") public javax.ws.rs.core.Response addWorklog(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("adjustEstimate") String adjustEstimate, @QueryParam("newEstimate") String newEstimate, @QueryParam("reduceBy") String reduceBy, WorklogJsonBean request)
      Adds a new worklog entry to an issue.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the worklog will be added to
      adjustEstimate - (optional) allows you to provide specific instructions to update the remaining time estimate of the issue. Valid values are
      • "new" - sets the estimate to a specific value
      • "leave"- leaves the estimate as is
      • "manual" - specify a specific amount to increase remaining estimate by
      • "auto"- Default option. Will automatically adjust the value based on the new timeSpent specified on the worklog
      newEstimate - (required when "new" is selected for adjustEstimate) the new value for the remaining estimate field. e.g. "2d"
      reduceBy - (required when "manual" is selected for adjustEstimate) the amount to reduce the remaining estimate by e.g. "2d"
      request - json body of request converted to a WorklogJsonBean
      Returns:
      the added worklog
    • getComments

      @GET @Path("{issueIdOrKey}/comment") public javax.ws.rs.core.Response getComments(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("startAt") Long startAt, @QueryParam("maxResults") Integer maxResults, @QueryParam("orderBy") String orderBy, @QueryParam("expand") String expand)
      Returns all comments for an issue.

      Results can be ordered by the "created" field which means the date a comment was added.

      Parameters:
      issueIdOrKey - to get comments for
      startAt - the page offset, if not specified then defaults to 0
      maxResults - how many results on the page should be included. Defaults to 50.
      orderBy - ordering of the results.
      expand - optional flags: renderedBody (provides body rendered in HTML)
      Returns:
      all comments for the issue
    • getPinnedComments

      @GET @Path("{issueIdOrKey}/pinned-comments") public javax.ws.rs.core.Response getPinnedComments(@PathParam("issueIdOrKey") String issueIdOrKey)
      Returns all pinned to the issue comments.
      Parameters:
      issueIdOrKey - of the issue the comment belongs to
      Returns:
      all pinned to the issue comments.
    • getComment

      @GET @Path("{issueIdOrKey}/comment/{id}") public javax.ws.rs.core.Response getComment(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String commentId, @QueryParam("expand") String expand)
      Returns a single comment.
      Parameters:
      commentId - the ID of the comment to request
      issueIdOrKey - of the issue the comment belongs to
      expand - optional flags: renderedBody (provides body rendered in HTML)
      Returns:
      a Response containing a CommentJsonBean
    • updateComment

      @PUT @Path("{issueIdOrKey}/comment/{id}") public javax.ws.rs.core.Response updateComment(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String commentId, @QueryParam("expand") String expand, CommentJsonBean request)
      Updates an existing comment using its JSON representation.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the comment belongs to
      commentId - id of the comment to be updated
      expand - optional flags: renderedBody (provides body rendered in HTML)
      request - json body of request converted to a CommentJsonBean
      Returns:
      updated Comment
    • setPinComment

      @PUT @Path("{issueIdOrKey}/comment/{id}/pin") public javax.ws.rs.core.Response setPinComment(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String commentId, boolean pinned)
    • deleteComment

      @DELETE @Path("{issueIdOrKey}/comment/{id}") public javax.ws.rs.core.Response deleteComment(@PathParam("issueIdOrKey") String issueIdOrKey, @PathParam("id") String commentId)
      Deletes an existing comment .
      Parameters:
      issueIdOrKey - a string containing the issue id or key the comment belongs to
      commentId - id of the comment to be deleted
      Returns:
      No Content Response
    • addComment

      @POST @Path("{issueIdOrKey}/comment") public javax.ws.rs.core.Response addComment(@PathParam("issueIdOrKey") String issueIdOrKey, @QueryParam("expand") String expand, CommentJsonBean request)
      Adds a new comment to an issue.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the comment will be added to
      expand - optional flags: renderedBody (provides body rendered in HTML)
      request - json body of request converted to a CommentJsonBean
      Returns:
      the added comment
    • notify

      @POST @Path("{issueIdOrKey}/notify") public javax.ws.rs.core.Response notify(@PathParam("issueIdOrKey") String issueIdOrKey, NotificationJsonBean request)
      Sends a notification (email) to the list or recipients defined in the request.
      Parameters:
      issueIdOrKey - a string containing the issue id or key the comment will be added to
      request - json body of request converted to a NotificationJsonBean
      Returns:
    • BAD_REQUEST

      protected javax.ws.rs.core.Response BAD_REQUEST()
      Returns a Response with a status code of 400.
      Returns:
      a Response with a status code of 400.
    • NO_CONTENT

      protected static javax.ws.rs.core.Response NO_CONTENT()
      Returns a Response with a status code of 204.
      Returns:
      a Response with a status code of 204