简体   繁体   English

JQL 查询 Jira curl 调用

[英]JQL query Jira curl call

I want to get issues of a certain issuetype from a project using the curl call for Jira api.我想使用 Jira api 的 curl 调用从项目中获取特定问题类型的问题。

curl -D- -X GET -H "Authorization: Basic encoded" -H "Content-Type: application/json" "site/rest/api/2/search?jql=project="GB" and issuetype="Risk""

This is the call i use.这是我使用的电话。 It gets all the issues of project GB and not only of type Risk.它获得了项目 GB 的所有问题,而不仅仅是 Risk 类型的问题。 I dont see where i go wrong with my JQL.我不知道我的 JQL 哪里出了问题。 I already replased issuetype with type but it still doesn't work.我已经用 type 替换了 issuetype 但它仍然不起作用。 It keeps returning all issues and not only the issues of type Risk.它不断返回所有问题,而不仅仅是风险类型的问题。

Your JQL is correct, but your curl commandline is not.你的 JQL 是正确的,但你的 curl 命令行不是。

You're using double quotes within a double quoted string.您在双引号字符串中使用双引号。 You'll have to either escape your inner double quotes or use single quotes instead.您必须转义内部双引号或改用单引号。

Eg try this:例如试试这个:

curl -D- -X GET -H "Authorization: Basic encoded" -H "Content-Type: application/json" "site/rest/api/2/search?jql=project=\"GB\" and issuetype=\"Risk\""

Is probably a problem due parsing of the link.由于解析链接可能是一个问题。

I suggest you to use the post search instead.我建议您改用帖子搜索。

curl -D- -u Username:Password  -X POST -H "Content-Type: application/json" --data "{\"jql\":\"project = GB and issueType = Risk\"}"  "site/rest/api/2/search"

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

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