Forums

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

Can't set original estimate field via Rest API v2

Matt Calcutt February 20, 2023

Im trying to create issues via the Rest API v2. It's all creating fine but when I want to set the original estimate it returns an error saying "Field 'timeoriginalestimate' cannot be set. It is not on the appropriate screen, or unknown."

I can see in my field editor that the original estimate field is definitely there and available to set against tickets when I add them in Jira. But when I go to the following link https://myProj.atlassian.net//rest/api/latest/issue/createmeta?projectKeys=ENG&expand=projects.issuetypes.fields 

The field doesn't exist.

Any ideas how to set the field (for the v2 api)?

2 answers

1 vote
Ajay _view26_
Community Champion
February 20, 2023

Hi @Matt Calcutt 

Welcome to the Atlassian Community!

Please refer to the comment in the ticket for updating the original estimate for an Issue - https://jira.atlassian.com/browse/JRACLOUD-33749

Matt Calcutt February 21, 2023

Yeah Im still having the same issue with it. It keeps returning the same issue saying "It is not on the appropriate screen, or unknown.". Here is a screenshot of my field configuraion and original estimate is definitely there:FieldExamples.png

Here is the code I'm using to run the update:

var credentials = Encoding.ASCII.GetBytes($"{JiraClient.username}:{JiraClient.password}");

using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(credentials));

var content = new StringContent("{\"update\":{\"timetracking\":[{\"edit\":{\"originalEstimate\": \"4m\",\"remainingEstimate\": \"3m\"} }]}}", Encoding.UTF8, "application/json");

using (var response = await client.PutAsync($"{JiraClient.baseUrl}/rest/api/2/issue/{ticketID}", content))
{
if (!response.IsSuccessStatusCode)
{
var responseJson = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Failed to update issue: {response.ReasonPhrase}");
}
}
}

 

Any ideas why this should still be saying the field doesn't exist?

0 votes
Vamsi Kandala
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2023

Hi @Matt Calcutt

Welcome to the Atlassian community!

The call URL 

https://myproj.atlassian.net//rest/api/latest/issue/createmeta?projectKeys=ENG&expand=projects.issuetypes.fields 

is not the right one to find the fields for the related issue type.

Instead, if you want to find what all fields are present in the issue type, take the existing ticket of that issue type and make a call like 

https://myproj.atlassian.net//rest/api/latest/issue/{ticketno}

Hope that you have replaced the '{ticketID}' with the actual ticket key in the URL call 

using (var response = await client.PutAsync($"{JiraClient.baseUrl}/rest/api/2/issue/{ticketID}"

Also, you are updating the existing ticket.  Did you check whether the field 'Original estimate' is present in the 'Edit' screen of this issue type.

Hope this helps.

Thanks,
Vamsi

Matt Calcutt February 21, 2023

Hi Vamsi, thanks for the reply. I can see the originalEstimate field is available when I run the URL provided I get the following output:

 

{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations,customfield_10010.requestTypePractice","id":"10086","self":"https://mextest.atlassian.net/rest/api/latest/issue/10086","key":"ENG-58","fields":{"statuscategorychangedate":"2023-02-22T09:18:11.062+1000","issuetype":{"self":"https://mextest.atlassian.net/rest/api/2/issuetype/10001","id":"10001","description":"Tasks track small, distinct pieces of work.","iconUrl":"https://mextest.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium","name":"Task","subtask":false,"avatarId":10318,"entityId":"c2a45d6c-568a-42d7-a7ea-92278eccf361","hierarchyLevel":0},"timespent":null,"customfield_10030":null,"project":{"self":"https://mextest.atlassian.net/rest/api/2/project/10000","id":"10000","key":"ENG","name":"Engineering","projectTypeKey":"software","simplified":true,"avatarUrls":{"48x48":"https://mextest.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10402","24x24":"https://mextest.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10402?size=small","16x16":"https://mextest.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10402?size=xsmall","32x32":"https://mextest.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10402?size=medium"}},"fixVersions":[],"customfield_10034":null,"aggregatetimespent":null,"resolution":null,"customfield_10035":null,"customfield_10036":null,"customfield_10037":"Staughton Group","customfield_10027":null,"customfield_10028":null,"customfield_10029":null,"resolutiondate":null,"workratio":0,"lastViewed":"2023-02-22T15:18:57.187+1000","issuerestriction":{"issuerestrictions":{},"shouldDisplay":true},"watches":{"self":"https://mextest.atlassian.net/rest/api/2/issue/ENG-58/watchers","watchCount":1,"isWatching":true},"created":"2023-02-22T09:18:10.660+1000","customfield_10020":null,"customfield_10021":null,"customfield_10022":null,"customfield_10023":null,"priority":{"self":"https://mextest.atlassian.net/rest/api/2/priority/3","iconUrl":"https://mextest.atlassian.net/images/icons/priorities/medium.svg","name":"Medium","id":"3"},"customfield_10024":null,"customfield_10025":null,"customfield_10026":null,"labels":[],"customfield_10016":null,"customfield_10017":null,"customfield_10018":{"hasEpicLinkFieldDependency":false,"showField":false,"nonEditableReason":{"reason":"PLUGIN_LICENSE_ERROR","message":"The Parent Link is only available to Jira Premium users."}},"customfield_10019":"0|i000fj:","timeestimate":7200,"aggregatetimeoriginalestimate":7200,"versions":[],"issuelinks":[],"assignee":null,"updated":"2023-02-22T15:23:11.529+1000","status":{"self":"https://mextest.atlassian.net/rest/api/2/status/10000","description":"","iconUrl":"https://mextest.atlassian.net/","name":"SCOPING","id":"10000","statusCategory":{"self":"https://mextest.atlassian.net/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}},"components":[],"timeoriginalestimate":7200,"description":"Programming - JDE Integration","customfield_10010":null,"customfield_10014":null,"customfield_10015":null,"timetracking":{"originalEstimate":"2h","remainingEstimate":"2h","originalEstimateSeconds":7200,"remainingEstimateSeconds":7200},"customfield_10005":null,"customfield_10006":null,"security":null,"customfield_10007":null,"customfield_10008":null,"customfield_10009":null,"aggregatetimeestimate":7200,"attachment":[],"summary":"50106 - Staughton Group - Ken McNamara","creator":{"self":"https://mextest.atlassian.net/rest/api/2/user?accountId=63eb00bfd4dc4e35db10265b","accountId":"63eb00bfd4dc4e35db10265b","emailAddress":"m.calsy@gmail.com","avatarUrls":{"48x48":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","24x24":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","16x16":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","32x32":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png"},"displayName":"Matt Calcutt","active":true,"timeZone":"Australia/Brisbane","accountType":"atlassian"},"subtasks":[],"customfield_10040":null,"customfield_10041":"2022-10-04","customfield_10042":["123"],"reporter":{"self":"https://mextest.atlassian.net/rest/api/2/user?accountId=63eb00bfd4dc4e35db10265b","accountId":"63eb00bfd4dc4e35db10265b","emailAddress":"m.calsy@gmail.com","avatarUrls":{"48x48":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","24x24":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","16x16":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png","32x32":"https://secure.gravatar.com/avatar/2760852f5c46c3e17fda3eb9b549a2b6?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMC-6.png"},"displayName":"Matt Calcutt","active":true,"timeZone":"Australia/Brisbane","accountType":"atlassian"},"customfield_10043":null,"aggregateprogress":{"progress":0,"total":7200,"percent":0},"customfield_10044":null,"customfield_10001":null,"customfield_10045":{"self":"https://mextest.atlassian.net/rest/api/2/customFieldOption/10020","value":"Customisation","id":"10020"},"customfield_10002":null,"customfield_10046":null,"customfield_10047":null,"customfield_10003":null,"customfield_10048":"50106","customfield_10004":null,"customfield_10038":"Ken McNamara","customfield_10039":"Email: kmcnamara@staughtongroup.com.au ","environment":null,"duedate":null,"progress":{"progress":0,"total":7200,"percent":0},"votes":{"self":"https://mextest.atlassian.net/rest/api/2/issue/ENG-58/votes","votes":0,"hasVoted":false},"comment":{"comments":[],"self":"https://mextest.atlassian.net/rest/api/2/issue/10086/comment","maxResults":0,"total":0,"startAt":0},"worklog":{"startAt":0,"maxResults":20,"total":0,"worklogs":[]}}}

 

So it's definitely available to update just whenever I try to insert a new issue with the originalEstimate or update an issue it says it doesn't exist. Can confirm also that Im replacing the URL with the TicketNo.

Any other ideas?

Vamsi Kandala
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2023

Hi @Matt Calcutt

Thank you for sending the response of the URL call.

To clarify further, note that the REST API call you made returns the details of the existing ticket having the fields in View screen.

Were you able to check whether this field is in Edit screen?

Also, did you try updating the ticket using third party tool like Postman so that we can narrow down what the error/ issue could be?

Thanks,
Vamsi

Matt Calcutt February 22, 2023

Hi Vamsi, Thanks for the reply.

I've double checked and the field exists in the edit screen. Here is a screenshot of the ticket Im trying to update in this example:

 

PropertiesExisting.png

I've put the calls into postman and still getting the same returns. Here are screenshots of the put methods I tried to update the ticket.

 

Example1.pngExample2.png

 

Any issues that you can see with the calls or edit?

Matt Calcutt February 22, 2023

I've found what the issue was. I had the originalEstimate field in the details. I needed to also add the Time Tracking field to the context fields.

Like petbb likes this
Vamsi Kandala
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2023

Hi @Matt Calcutt

Glad that you are able to figure out the issue.

I have also tested at my end and this part of code worked for me:

 

{
    "fields": {
         "timetracking": {
            "originalEstimate""3m",
            "remainingEstimate""4m"
        }     
    }
}
Regards,
Vamsi
Petrykiv Dmytro
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 24, 2024

Hi @Matt Calcutt ! Can you please explain in more detail, how you fix it? Thank you!

Diaa Hassan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 10, 2024

Hello @Petrykiv Dmytro ,

I have recorded the steps and you can find it in here

updating-jira-project-screen-fields 

Like fajtlapa likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events