代码之家  ›  专栏  ›  技术社区  ›  Europa

Python JIRA Rest API从板上获取案例ORDER BY上次更新

  •  -1
  • Europa  · 技术社区  · 3 年前

    我已经成功地获得了一个使用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']
    
    1 回复  |  直到 3 年前
        1
  •  1
  •   A l w a y s S u n n y    3 年前

    您可以使用搜索问题 JQL 字符串并执行 ordering 像这样-

    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']