https://www.atlassian.com/software/jira

The best software teams ship early and often.

Jira Software is built for every member of your software team to plan,
track, and release great software.

 

REST API

search with jql

https://docs.atlassian.com/software/jira/docs/api/REST/8.12.2/#api/2/search-search

SearchGET /rest/api/2/search

 

Searches for issues using JQL.

Sorting the jql parameter is a full JQL expression, and includes an ORDER BY clause.

The fields param (which can be specified multiple times) gives a comma-separated list of fields to include in the response. This can be used to retrieve a subset of fields. A particular field can be excluded by prefixing it with a minus.

 

Request
query parameters
parameter type description
jql string

a JQL query string

startAt int

the index of the first issue to return (0-based)

maxResults int

the maximum number of issues to return (defaults to 50). The maximum allowable value is dictated by the Jira property 'jira.search.views.default.max'. If you specify a value that is higher than this number, your search results will be truncated.

validateQuery boolean

Default: true

whether to validate the JQL query

fields string

the list of fields to return for each issue. By default, all navigable fields are returned.

expand string

A comma-separated list of the parameters to expand.

Responses
  • Status 200 - application/json
    Returns a JSON representation of the search results.
    Example
    {
        "expand": "names,schema",
        "startAt": 0,
        "maxResults": 50,
        "total": 1,
        "issues": [
            {
                "expand": "",
                "id": "10001",
                "self": "http://www.example.com/jira/rest/api/2/issue/10001",
                "key": "HSP-1"
            }
        ]
    }
    Schema
  • Status 400
    Returned if there is a problem with the JQL query.

 

Issue API

https://docs.atlassian.com/software/jira/docs/api/REST/8.12.2/#api/2/issue

api/2/issueExpand all methods

 

Create issuePOST /rest/api/2/issue

 

Create issuesPOST /rest/api/2/issue/bulk

 

Get issueGET /rest/api/2/issue/{issueIdOrKey}

 

Delete issueDELETE /rest/api/2/issue/{issueIdOrKey}

 

Edit issuePUT /rest/api/2/issue/{issueIdOrKey}

 

Archive issuePUT /rest/api/2/issue/{issueIdOrKey}/archive

 

AssignPUT /rest/api/2/issue/{issueIdOrKey}/assignee

 

Get commentsGET /rest/api/2/issue/{issueIdOrKey}/comment

 

Add commentPOST /rest/api/2/issue/{issueIdOrKey}/comment

 

Update commentPUT /rest/api/2/issue/{issueIdOrKey}/comment/{id}

 

Delete commentDELETE /rest/api/2/issue/{issueIdOrKey}/comment/{id}

 

Get commentGET /rest/api/2/issue/{issueIdOrKey}/comment/{id}

 

Get edit issue metaGET /rest/api/2/issue/{issueIdOrKey}/editmeta

 

NotifyPOST /rest/api/2/issue/{issueIdOrKey}/notify

 

Get remote issue linksGET /rest/api/2/issue/{issueIdOrKey}/remotelink

 

Create or update remote issue linkPOST /rest/api/2/issue/{issueIdOrKey}/remotelink

 

Delete remote issue link by global idDELETE /rest/api/2/issue/{issueIdOrKey}/remotelink

 

Get remote issue link by idGET /rest/api/2/issue/{issueIdOrKey}/remotelink/{linkId}

 

Update remote issue linkPUT /rest/api/2/issue/{issueIdOrKey}/remotelink/{linkId}

 

Delete remote issue link by idDELETE /rest/api/2/issue/{issueIdOrKey}/remotelink/{linkId}

 

Restore issuePUT /rest/api/2/issue/{issueIdOrKey}/restore

 

Get transitionsGET /rest/api/2/issue/{issueIdOrKey}/transitions

 

Do transitionPOST /rest/api/2/issue/{issueIdOrKey}/transitions

 

Remove voteDELETE /rest/api/2/issue/{issueIdOrKey}/votes

 

Add votePOST /rest/api/2/issue/{issueIdOrKey}/votes

 

Get votesGET /rest/api/2/issue/{issueIdOrKey}/votes

 

Get issue watchersGET /rest/api/2/issue/{issueIdOrKey}/watchers

 

Add watcherPOST /rest/api/2/issue/{issueIdOrKey}/watchers

 

Remove watcherDELETE /rest/api/2/issue/{issueIdOrKey}/watchers

 

Get issue worklogGET /rest/api/2/issue/{issueIdOrKey}/worklog

 

Add worklogPOST /rest/api/2/issue/{issueIdOrKey}/worklog

 

Get worklogGET /rest/api/2/issue/{issueIdOrKey}/worklog/{id}

 

Update worklogPUT /rest/api/2/issue/{issueIdOrKey}/worklog/{id}

 

Delete worklogDELETE /rest/api/2/issue/{issueIdOrKey}/worklog/{id}

 

Archive issuesPOST /rest/api/2/issue/archive

 

deprecatedGET /rest/api/2/issue/createmeta

 

Get create issue meta project issue typesGET /rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes

 

Get create issue meta fieldsGET /rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}

 

Get issue picker resourceGET /rest/api/2/issue/picker

 

PYTHON LIBRARY

https://jira.readthedocs.io/en/master/installation.html

The easiest (and best) way to install jira-python is through pip:

$ pip install jira

https://jira.readthedocs.io/en/master/examples.html

# This script shows how to use the client in anonymous mode
# against jira.atlassian.com.
from jira import JIRA
import re

# By default, the client will connect to a Jira instance started from the Atlassian Plugin SDK
# (see https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK for details).
# Override this with the options parameter.
options = {"server": "https://jira.atlassian.com"}
jira = JIRA(options)

# Get all projects viewable by anonymous users.
projects = jira.projects()

# Sort available project keys, then return the second, third, and fourth keys.
keys = sorted([project.key for project in projects])[2:5]

# Get an issue.
issue = jira.issue("JRA-1330")

# Find all comments made by Atlassians on this issue.
atl_comments = [
    comment
    for comment in issue.fields.comment.comments
    if re.search(r"@atlassian.com$", comment.author.emailAddress)
]

# Add a comment to the issue.
jira.add_comment(issue, "Comment text")

# Change the issue's summary and description.
issue.update(
    summary="I'm different!", description="Changed the summary to be different."
)

# Change the issue without sending updates
issue.update(notify=False, description="Quiet summary update.")

# You can update the entire labels field like this
issue.update(fields={"labels": ["AAA", "BBB"]})

# Or modify the List of existing labels. The new label is unicode with no
# spaces
issue.fields.labels.append(u"new_text")
issue.update(fields={"labels": issue.fields.labels})

# Send the issue away for good.
issue.delete()

# Linking a remote jira issue (needs applinks to be configured to work)
issue = jira.issue("JRA-1330")
issue2 = jira.issue("XX-23")  # could also be another instance
jira.add_remote_link(issue, issue2)

 

相关文章:

  • 2022-12-23
  • 2021-08-26
  • 2021-08-25
  • 2021-11-20
  • 2021-05-02
猜你喜欢
  • 2021-11-20
  • 2021-09-11
  • 2021-09-25
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
相关资源
相似解决方案