0
votes

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

1 Answers

0
votes

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]}'