Getting Billable Field in Jira Rest API

Hi Team

I have been using api for getting all the issues of any project. Although I am getting all the fields from the issue, one that is particulary important missing is Billable field. Can you guide me in how to retreive data for this field on issue level.

2 answers

0 votes
Alexey Matveev Community Champion Nov 19, 2017

Hello,

What REST API do you use to get all the issues of any project?

Hi,  Alexey

 

I am using following url for getting issue data of particular project.

"rest/api/2/search?jql=project=TWOXL&startAt=0&maxResults=100"

 

But I am not able to retreive billable field from above url result

Alexey Matveev Community Champion Nov 20, 2017

By default only navigable fields are shown. You should change your rest to

"rest/api/2/search?jql=project=TWOXL&startAt=0&maxResults=100&fields=*all"

You need to pass fields=*all parameter

Hi Alexey,

I am still not able to get the billable field/key inside the response. Can you elaborate on this

Alexey Matveev Community Champion Nov 20, 2017

The Billable field is a custom field, right? What is the type of the field? Kindly by this REST call try to select an issue which has the field filled.

I don't think this is a custom field, its provided as default with the API, but in case if it is a custom field, how should I approach it. Also I have gone through plenty of issues, but haven't found any filed that matches billable/non-billable

It is definitely a custom field.  Most of the Jira systems I work with do not have it, and it is not there when you install a new one.

Could you maybe look at an issue that has a value for it in the UI and then make a REST call to fetch the same issue so we can see that it is there and how it comes out?

I checked the list of custom fields by going to JIRA Administration>Issues>Fields>Custom Fields. It's not there on that list so it's not a custom field. 

Btw, the name of that field is 'Non-Billable'. It's a checkbox that appears when someone enters a worklog.

Alexey Matveev Community Champion Nov 20, 2017

I guess it is a Tempo plugin field and it relates to worklogs, not to issues. You would need to use Tempo Rest Api to get the information. Try to use

http://{JIRA_BASE_URL}/rest/tempo-timesheets/3/worklogs/

You can read more about REST API here

https://tempo.io/doc/timesheets/api/rest/latest/

I tried replacing {JIRA_BASE_URL} with account domain, but I am not getting any response. I am getting 504 as response code.

Sorry my bad, I wasn't using proper url to fetch the data, but still I am not getting the non-billable field in the response , I am using the following url for getting data - "rest/tempo-timesheets/3/worklogs?projectKey=TWOXL"

Hi Alexey,

I found the field. Thanks for the help.

0 votes
Alexey Matveev Community Champion Nov 20, 2017

Error 504 means that the result was not returned in the specified time. I guess you need to enter some limits. For example limit it by date

/rest/tempo-timesheets/3/worklogs?dateFrom=2017-11-19

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

458 views 7 5
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