Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Rest API Ticket変更履歴のstatusのみ抽出する方法について

川上英雄
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 15, 2019

JiraのRest APIを使用して、
チケット履歴情報を取得しようとしています。

チケットの変更履歴を取得する際、
以下の(1)の方法で全履歴情報を取得することはできますが、
(2)のように設定して、statusだけの変更履歴だけを
取得しようとしていますが、エラーとなります。

(1)https://XXXXX.atlassian.net/rest/api/2/issue/KEY-1001/changelog
(2)https://XXXXX.atlassian.net/rest/api/2/issue/KEY-1001/changelog/changelog?field=status

(1)json形式で取得した結果は以下の通りです。

{
"self": "https://XXXXX.atlassian.net/rest/api/2/issue/KEY-1001/changelog",
"maxResults": 100,
"startAt": 0,
"total": 62,
"isLast": true,
"values": [
{
"id": "12387",
"author":

{ :(省略) }

,
"created": "2018-11-07T10:25:43.162+0900", ★
"items": [

{ "field": "status", ★このstatus部分だけ取得したい "fieldtype": "jira", "fieldId": "status", "from": "10001", "fromString": "To Do", ★ "to": "3", "toString": "In Progress" ★ }

]
},

上記のstatus項目の★印部分のみ
取得したく、質問させて頂きました。

1チケット当り、履歴情報が60件程あり、
約2000件のチケットから履歴情報を全て参照して、
status情報をEXCEL(VBA)で取得しようとすると、
25分程度かかるため、処理時間を少なくしたいため、
上記のstatus情報だけを取得できないか、ご教示願います。

1 answer

1 vote
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2019

Hello Hideo and welcome to the community!

The REST endpoint of GET /rest/api/3/issue/{issueIdOrKey}/changelog only have 2 available query parameters. Those parameters are startAt and maxResults. This is most likely why the API response is not acknowledging your attempt at ?field=status. You do have options moving forward.

You may use a script to GET the REST API response and from there parse the data you need within the script. This would allow you to store the JSON response as a variable and only pull out the fields you need to display or report on.

Another option would be to use SQL to ingest the JSON data into a table format. From there you can connect excel to said table and report on the columns you need.

Both methods would require in-house development to create scripts which will allow for communicating with the systems and parsing or storing the data. These scripts would be transferable to other aspects of the API which you wanted to GET data from as well.

If you do want to proceed with one of these methods, please let me know and we can work together to develop something to parse or ingest your data.

Regards,
Stephen Sifers

Google translate:

こんにちは英雄さん、地域社会へようこそ!
GET / rest / api / 3 / issue / {issueIdOrKey} / changelogのRESTエンドポイントには、2つの利用可能なクエリパラメータしかありません。それらのパラメータはstartAtとmaxResultsです。 APIレスポンスが?field = statusでの試みを確認していないのは、このためです。あなたは前進する選択肢があります。
スクリプトを使用してREST API応答を取得し、そこからスクリプト内で必要なデータを解析することができます。これにより、JSONレスポンスを変数として格納し、表示またはレポートする必要があるフィールドのみを取り出すことができます。
もう1つの選択肢は、SQLを使用してJSONデータを表形式に取り込むことです。そこからあなたは前記テーブルにエクセルを接続してあなたが必要とする列について報告することができます。
どちらの方法でも、システムと通信してデータを解析または保存するためのスクリプトを作成するための社内開発が必要になります。これらのスクリプトは、データを取得したいAPIの他の側面にも転送可能です。
あなたがこれらの方法のうちの1つを続行したいならば、私に知らせてください、そして、私たちはあなたのデータをパースまたは摂取するために何かを開発するために一緒に働きます。
よろしく、
スティーブン・シファーズ
川上英雄
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2019

Dear Stephen Sifers

I'm sorry for the late reply.
Thank you for your advice.
You can Close this question.

Regards,
H.kawakami

 

Like Stephen Sifers likes this
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 25, 2019

Hello Hideo,

Glad you found the answer helpful.

If the answer helped to resolve your issue or give you direction, please select the 'Accept Answer' button. This will let others know this answer helped you.

Regards,
Stephen Sifers

Suggest an answer

Log in or Sign up to answer