searching an issue

if i want POST request to search an issue, how should the request.json should luk like if we are using the following search conditions.

  1. deployement finish date = 2016/12/12
  2. summary = its a JIRA API test

    Basically, i am able to use GET request having search conditions at the end of the request URL, but i want POST request so that i dont have to embed data in the URL.

3 answers

0 vote

Hello Kumar,

Could you please attach a screenshot displaying where you are extracting the (deployment finish date = 2016/12/12) from in your JIRA issue, for instance?

Kind regards,

Rafael

curl -D- -u abc:xyz -X GET -H "Content-Type: application/json" "https://tracker.wal-mart.com:443/rest/api/2/search?jql=%22Deployment%20Finish%20Date%22%20%3D%202016-12-12

 

This is able to fetch me the correct data but I want to POST this search criteria in a separate json file.

{
"jql":
"Deployment Finish Date = 2016/12/01"
}


{"errorMessages":["Error in the JQL Query: Expecting operator but got 'Finish'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 12)"],"errors":{}}


These more than one words fields, are creating problem bcaz of space between them.

 

Please let me know if any general solution or concept i am missing.

@Rafael Sperafico. Is the provided info fine afainst ur question.

Hello Kumar,

Thank you for the cURL command, however, it would be best if you could send a screenshot displaying where the Deployment Finish Date is located in your case scenario.

Hi,

@Rafael Sperafico in the right bottom corner, its there. But how does it matter.??

 

image2016-12-27 16:38:29.png

Hello Kumar,

But how does it matter?

Depending on the location, the way you call the property can vary.

Based on your first inquire, the following should do the request you are looking for:

{
    "jql": "summary ~ \"its a JIRA API test\" AND \"Deployment Finish Date\" = \"2016-12-12\"",
    "startAt": 0,
    "maxResults": 15,
    "fields": [
        "summary",
        "status",
        "assignee",
        "created",
        "updated"
    ]
}
curl -k -u JIRA_ADMIN -p \
     -H "Content-Type: application/json" \
	 -H "Accept: application/json" \
	 -d '@json.payload' \
	 -X POST "http://localhost:8080/rest/api/2/search"

Kind regards,

Rafael

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

60 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you