搜索
JIRA 获取查询语句
An easy way to get the proper encoding is to
- build your search in JIRA first
- When you have the results you want, click the Views button in Issue Navigator
- Right-click the XML link and copy the link address. It has all the proper formatting already.
- Paste everything that comes after ‘jqlQuery=’ into your code and add your variables and such.
https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/
排序逻辑
按照问题id大小排序, 类似project = projectKey AND statusCategory = Done AND issuetype in (线上缺陷, Bug) ORDER BY issuekey DESC
。其中的 issuekey
为多个可排序的自定义字段,可以从/rest/api/2/field
查看到哪些字段可参与排序,例如resolutiondate
解决时间排序
jql高级搜索api,jql: Jira Query Language——待实践
其他操作
创建issue
必选项:summary、description、issuetype、reporter 可选项:assignee、labels
https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-post
项目实例: https://bitbucket.org/atlassian/atlassian-connect-spring-boot/src/master/README.md
Basic 验证方式:
https://developer.atlassian.com/server/jira/platform/basic-authentication
需要对用户名和密码做Base64转码, 例如 fred:fred
转码为ZnJlZDpmcmVk
curl -H "Authorization: Basic ZnJlZDpmcmVk" -X GET -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/createmeta
Basic 验证下的API调研 https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/
修改issue状态
先查询JIRA下对应的transition的定义 https://developer.atlassian.com/cloud/jira/platform/rest/v3/?#api-rest-api-3-issue-issueIdOrKey-transitions-get
GET /rest/api/3/issue/{issueIdOrKey}/transitions
根据查询到的transitions进行操作 https://developer.atlassian.com/cloud/jira/platform/rest/v3/?#api-rest-api-3-issue-issueIdOrKey-transitions-post
ObjectNode payload = jnf.objectNode();
ObjectNode transition = payload.putObject("transition");
transition.put("id", "401");
HttpResponse<JsonNode> response = Unirest.post(String.format("http://project.jira-corp.com/rest/api/2/issue/%s/transitions", id))
.basicAuth("user", "password")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body(payload)
.asJson();
comments powered by Disqus