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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

@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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

126 views 1 3
Join discussion

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