0

I would like to get some information from jira project, using http method, f.e.:

curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/search?jql=project=XXX%20created='-5d'

After all, I received a lot of information, but I would like get only one tag:

{"expand":"schema,names","startAt":0,"maxResults":50,"total":1234,"issues": here - multiple lines....

Have You maybe idea, how I can get only "total":1234 field?

Thank You in advance.

1 Answer 1

0

Add the following to your URL:

&maxResults=0

Which will result in a return like:

{
  "startAt": 0,
  "maxResults": 0,
  "total": 3504,
  "issues": []
}

You can then pipe you're curl to an awk and get the number only with:

curl --silent "https://jira.atlassian.com/rest/api/2/search?jql=project=STASH%20&created=%27-5d%27&maxResults=0" | awk '{split($0,a,":"); print a[4]}' | awk '{split($0,a,","); print a[1]}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.