searching an issue

Kumar Gaurav December 22, 2016

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 votes
Kumar Gaurav December 25, 2016

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

rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 26, 2016

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.

Kumar Gaurav December 27, 2016

Hi,

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

 

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

rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 27, 2016

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

0 votes
Kumar Gaurav December 25, 2016

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.

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 23, 2016

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

Suggest an answer

Log in or Sign up to answer