Jira Cloud fields and work types
Jira timetracking field: original estimate via the API
timetracking is an object with originalEstimate and remainingEstimate as duration strings. Setting originalEstimate to 2h made Jira fill remainingEstimate too, and a read returns both strings plus their values in seconds.
Endpoints
| Method | Path | What it does |
|---|---|---|
PUT | /rest/api/3/issue/{issueIdOrKey} | Sets fields.timetracking.originalEstimate. |
GET | /rest/api/3/issue/{issueIdOrKey} | Returns timetracking and the numeric time fields. |
Examples
PUT /rest/api/3/issue/{issueIdOrKey}
Sets the original estimate to two hours. Without returnIssue the call has no body.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"timetracking": {
"originalEstimate": "2h"
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'fields': {'timetracking': {'originalEstimate': '2h'}}},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
Reads timetracking back. Both estimates and their second values are present.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=priority,duedate,labels,components,fixVersions,environment,timetracking,reporter,status,resolution,issuetype,project,created,updated' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'priority,duedate,labels,components,fixVersions,environment,timetracking,reporter,status,resolution,issuetype,project,created,updated'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-6",
"fields": {
"timetracking": {
"originalEstimate": "2h",
"remainingEstimate": "2h",
"originalEstimateSeconds": 7200,
"remainingEstimateSeconds": 7200
}
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
The numeric time fields and progress objects that are derived from the same estimate.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=*navigable' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': '*navigable'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"fields": {
"timeoriginalestimate": 7200,
"timeestimate": 7200,
"progress": {
"progress": 0,
"total": 7200,
"percent": 0
},
"aggregateprogress": {
"progress": 0,
"total": 7200,
"percent": 0
}
}
}Sent to Atlassian Cloud on .
PUT /rest/api/3/issue/{issueIdOrKey}
Sets a mixed-unit original estimate and a separate remaining estimate.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"timetracking": {
"originalEstimate": "1w 2d 3h 30m",
"remainingEstimate": "1d"
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'fields': {'timetracking': {'originalEstimate': '1w 2d 3h 30m',
'remainingEstimate': '1d'}}},
)
print(r.status_code, r.text)Response: HTTP 204
No response body.
Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
Reads the result: strings and seconds.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=timetracking,timeoriginalestimate,timeestimate,aggregatetimeoriginalestimate' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'timetracking,timeoriginalestimate,timeestimate,aggregatetimeoriginalestimate'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-11",
"fields": {
"timeestimate": 28800,
"aggregatetimeoriginalestimate": 214200,
"timeoriginalestimate": 214200,
"timetracking": {
"originalEstimate": "1w 2d 3h 30m",
"remainingEstimate": "1d",
"originalEstimateSeconds": 214200,
"remainingEstimateSeconds": 28800
}
}
}Sent to Atlassian Cloud on .
PUT /rest/api/3/issue/{issueIdOrKey}
Sends a duration written in words.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"timetracking": {
"originalEstimate": "two hours"
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'fields': {'timetracking': {'originalEstimate': 'two hours'}}},
)
print(r.status_code, r.text)Response: HTTP 400
{
"errorMessages": [],
"errors": {
"timetracking_originalestimate": "Specify a valid value for Original estimate",
"timetracking": "Specify a valid value for Original estimate"
}
}Sent to Atlassian Cloud on .
How it behaves
- PUT with timetracking.originalEstimate 2h and no returnIssue answered 204 with no body (sys-timetracking).
- A later read showed originalEstimate 2h, remainingEstimate 2h and 7200 seconds for both. The numeric fields and progress showed 7200 too, with percent 0 (read-system-fields, read-navigable).
- GET /rest/api/3/field lists timetracking as not navigable, so *navigable does not return the object and the numbers come in the time fields (fields-all, read-navigable).
- 1w 2d 3h 30m became 214200 seconds and a remaining estimate of 1d became 28800, so a day counts as 8 hours and a week as 5 days (sys-timetracking-units, sys-timetracking-read).
- two hours answered 400 with Specify a valid value for Original estimate, under both timetracking and timetracking_originalestimate (sys-timetracking-bad).
Pitfalls
- Use the explicit fields parameter when the object is needed. The *navigable selection returned the separate time fields, not timetracking.
- Seconds fields are derived and not set directly in these runs. Write the duration string and read the numbers back.
- Estimates exist only when time tracking is turned on for the site. The field list drops it when the setting is off, according to the OpenAPI text for GET /rest/api/3/field.
Questions and answers
What format does originalEstimate take?
Units of w, d, h and m worked in one string: 1w 2d 3h 30m. Words such as two hours were refused with 400.
Why does the update return nothing?
Without returnIssue=true a successful PUT answers 204 with no body, as the OpenAPI description says.
Related
- Read-only and computed system fields
- Reading field values: names, schema, v2 and v3
- Which fields can be set: editmeta and createmeta
- Field ids, keys and names
- Number (float)