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

查看:34
本文介绍了如何获取(通过 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天全站免登陆