简体   繁体   English

如何使用 atlassian rest api 在日期范围之间获取 Jira 问题数据

[英]How to get Jira issue data between date range using atlassian rest api

I'm using Jira atlassian rest API to pull the issue details updated/created between date range using Python requests.我正在使用 Jira atlassian rest API 来提取使用 Python 请求在日期范围之间更新/创建的问题详细信息。 But it seems not working.但它似乎不起作用。

Say for example, I wanted to extract the issue's which has been updated/created between 1st Jan 2018 to 31st Dec 2018 I have tried below API with JQL search.例如,我想提取已在 2018 年 1 月 1 日至 2018 年 12 月 31 日之间更新/创建的问题,我在 API 下尝试使用 JQL 搜索。 However that returns all the issue's created/updated since 1st Jan 2018 to till date and not limited to 31st Dec 2018.但是,这将返回自 2018 年 1 月 1 日至今创建/更新的所有问题,不限于 2018 年 12 月 31 日。

Can someone help me to achieve the desired result please.有人可以帮助我达到预期的结果吗? Thanks.谢谢。

Sample API示例 API

https://xxx-abc.atlassian.net/rest/api/3/search/?jql=updatedDate>=2018-01-01&updatedDate<=2018-12-31

I see two main problems with your REST API call:我发现您的 REST API 调用存在两个主要问题:

  1. You do not escape some special characters ( = , / , etc.), which are not allowing in URLs.您不会对 URL 中不允许的某些特殊字符( =/等)进行转义。
  2. You (possibly) provide the date in the wrong format.您(可能)以错误的格式提供日期。 Not sure about this, might be correct, depending on your settings.不确定这一点,可能是正确的,具体取决于您的设置。

Generally most of the time it is a good idea to develop the JQL query within Jira itself, to see if it is working correctly.通常大多数情况下,在 Jira 本身内开发 JQL 查询是一个好主意,以查看它是否正常工作。 Jira helps to write JQL queries, as it validates them before actually performing the query. Jira 有助于编写 JQL 查询,因为它在实际执行查询之前验证它们。

So I tried to resemble you JQL on my Jira instance, where the following was working:所以我试图在我的 Jira 实例上模仿你的 JQL,在那里工作:

updatedDate >= "2018/01/01" and updatedDate <= "2018/12/31"

After running this query, you will see the URL translation of the request in the URL window of your browser.运行此查询后,您将在浏览器的 URL 窗口中看到请求的 URL 转换。 With the JQL query from the URL contains following snippet regarding the JQL statement:来自 URL 的 JQL 查询包含以下关于 JQL 语句的片段:

?jql=updatedDate >%3D "2018%2F01%2F01" and updatedDate <%3D%20 "2018%2F12%2F31"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM