如何获取(通过GET)所有JIRA问题?我是否要转到“搜索"节点? [英] How can I fetch (via GET) all JIRA issues? Do I go to the Search node?

查看:92
本文介绍了如何获取(通过GET)所有JIRA问题?我是否要转到“搜索"节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/api/2/project看起来很容易以JSON格式返回JIRA实例中的所有项目.

It looks like /api/2/project easily returns all projects in a JIRA instance in JSON format.

我想对问题做同样的事情,但这似乎不存在.

I'd like to do the same for issues, but this does not appear to exist.

/api/2/search是执行像这样的大量转储的标准方法吗?定期将其更新到数据库的最佳方法是什么?我会做一些类似的搜索(更新日期> [数据库中的最后一个条目]),然后进行分页吗?当然,我不能成为第一个尝试此操作的人,尽管我在网上看不到任何类似的指南(我检查了Jira自己的文档,实际上没有大批量出口指南).

Is /api/2/search the standard way to do a mass-dump like this? And what is the best way to regularly update this to a database? Would I do something like search (update date > [last entry in database]) and then go through the pagination? Surely I can't be the first person attempting this, though I see no similar guide anywhere online to this (I checked Jira's own docs, no mass-issue-export guide really).

好吧,看起来好像搜索实际上是问题转储",而不是问题节点,与他们的文档相反,它不是默认集合,而是真正用于创建问题或一次列出一个问题.我可能会选择更新的路线> [无论数据库中的最后日期是什么]

Okay it looks like search really is the "issue dump" and not the issue node which, contrary to their documentation, does not default to a collection but really for creating issues or listing one at at time. I'll probably go the route of updated > [whatever last date is in the DB]

推荐答案

除非问题很少,否则无法一次获取所有问题. 您可以做的就是逐步执行搜索.

Unless you have very few issues, you can't fetch all of them at once. What you can do is to execute the search step by step.

例如,假设您有1324个JIRA问题.为了检索所有这些文件,您必须执行几次类似的搜索:

For example, lets say you have 1324 JIRA issues. In order to retrive all of them you have to execute a search similar to this several times:

/rest/api/2/search?&maxResults=100&startAt=0

这将从0开始检索前100个JIRA问题. 如何获得其他人?

This will retrive the first 100 JIRA issues starting from 0. How to get the others?

执行搜索时,将返回一个名为total的字段.该字段是系统中JIRA问题总数(1324问题).

When you execute the search, a field named total is returned. That field is the number of the total JIRA issues in your system (1324 issues).

下一个查询将是:

/rest/api/2/search?&maxResults=100&startAt=100

重复此操作,每次将startAt的值增加100,直到返回所有问题.

Repeat this operation, incrementing the value of startAt by 100 every time, until all the issues are returned.

这篇关于如何获取(通过GET)所有JIRA问题?我是否要转到“搜索"节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆