簡體   English   中英

Python JIRA Rest API 從版塊獲取案例 ORDER BY 最后更新

[英]Python JIRA Rest API get cases from board ORDER BY last updated

我已經成功地獲得了一個使用 Python 代碼的 Jira rest API。 它列出了案例。 但是,它列出了按創建日期排序的最后 50 個案例。 我想按更新日期列出 50 個案例。

這是我的 Python 代碼:

jiraOptions = {'server': "https://xxx.atlassian.net"}
jira = JIRA(options=jiraOptions, basic_auth=(jira_workspace_email, jira_api_token))

for singleIssue in jira.search_issues(jql_str=f"project = GEN"):
    key = singleIssue.key
    raw_fields_json = singleIssue.raw['fields']
    created = raw_fields_json['created']
    updated = raw_fields_json['updated']

您可以使用JQL字符串搜索問題並執行這樣的排序-

jiraOptions = {'server': "https://xxx.atlassian.net"}
jira = JIRA(options=jiraOptions, basic_auth=(jira_workspace_email, jira_api_token))

# Modify the JQL string to include the "order by" clause
jql_str = f"project = GEN order by updated"

for singleIssue in jira.search_issues(jql_str=jql_str):
    key = singleIssue.key
    raw_fields_json = singleIssue.raw['fields']
    created = raw_fields_json['created']
    updated = raw_fields_json['updated']

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM