Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding time tracking field to subtask while creating issue through rest api

shubham_jain July 30, 2020

I have been using the next-gen project in Jira.

I have added the time tracking field for the issue(sub-task) in issue types menus in its Jira board

{ 
"update": {},
"fields": {
"summary": "AS Handover u0026 Brief Meeting",
"issuetype": { "id": "10943" },
"project": { "key": "JSIDB" },
"description": {
"type": "doc",
"version": 1,
"content": [
{

"type": "paragraph",
"content": [
{
"text": " ",
"type": "text"
}
]

}
] },
"fixVersions": [
{
"id": "36414" }
],

"duedate": "2020-05-04",
"parent": { "id": "259818" },
"timetracking": { "remainingEstimate": "0", "originalEstimate": 60.0 } }
} 

I am creating an issue (sub-task) through create issue api - "https://companyname.atlassian.net/rest/api/3/issue/"
and above code-block is the body been sent with the end-point.

It returns me the response with the following error

{ 
"errorMessages": [],
"errors": { "timetracking": "Field 'timetracking' cannot be set. It is not on the appropriate screen, or unknown."
}
}

 Any suggestions for the problem mentioned above wherein I can add time tracking values to issue.

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 31, 2020

Hi,

I understand you're using the REST API in order to try to add timetracking information to an issue at the time of creation.

The error you are seeing is an indication that this timetracking field does not appear on the create screen.  And that part is true, the field is not on the create screen. However because this is next-gen, you can't actually modify the create screen.  You can add that field to the issue type, and you'll need to do that just be able to do time tracking here.  However the timetracking is a different kind of field than others here.

Next-gen does not offer users in the web application the ability to set this on issue creation.  You can also query the metadata endpoint in order to see what fields are available there, more details in GET /rest/api/3/issue/createmeta.

When I do this in my own next-gen project, the timetracking field does not appear here.  In turn I don't see a way in which you could currently set any timetracking value at the time of issue creation here.  Instead you would have to create the issue first, and then you can edit the issue to set that field or call the add worklog endpoint POST /rest/api/3/issue/{issueIdOrKey}/worklog to log this time.

 

Does this help?

Andy

shubham_jain August 6, 2020

Thanks @Andy Heinzer 

Yeah, it did help me. In the Next-gen board, we can't add and edit the time tracking field for an issue through rest APIs.

Post Endpoint: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

PUT Endpoint: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put

Is this correct understanding of the next-gen board issue create/edit?

Screenshot 2020-08-06 at 3.42.18 PM.pngBased on the image attached above, I have created this project and have admin permission so wanted to know, how can I edit or add hours to time tracking: estimated and remaining field.

Let me know if it is possible through rest API.

shubham_jain August 6, 2020

 "Instead you would have to create the issue first, and then you can edit the issue to set that field or call the add worklog endpoint POST /rest/api/3/issue/{issueIdOrKey}/worklog to log this time."

I have been through the worklog endpoint and I feel it helps in logging the hours spent on an issue and it doesn't solve my purpose.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 6, 2020

Thanks for your screenshot.  I can now see that you're not just using Jira Cloud by itself, but you also appear to be using the Tempo Timesheets app.  This adds a layer of functionality in regards to how time is being tracked AND estimated within Jira Cloud next-gen projects.  Tempo has the ability to store and track such time separately from Jira's own APIs.

However in next-gen projects it is not currently possible to generate a time estimate for issues.  There is an existing feature request for this in JSWCLOUD-17248.  The fact that this appears to be possible in the web view of your site is likely due to the Tempo App providing this functionality.  Note that time estimates are possible in Classic projects, and next-gen currently only has story point estimations available to it natively (without other apps).

Since you're using Tempo, it still does not appear that you can set the estimate at the time of issue creation in Jira Cloud next-gen project, but it does look like using the Tempo REST API for Create worklogs, that you can set a remainingEstimate value there when creating a worklog.  Perhaps this will be more helpful for your use case here.

Andy

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events