Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,913
Community Members
 
Community Events
184
Community Groups

When add worklog via REST API(version 2), get 400 if the worklog contains 'adjustEstimate'

When trying to add worklog like below, get 400 as return code. However if I comments out the two lines with underscore(adjustEstimate and newEstimate), then will get 201 and the worklog can be added successfully.
        auth = self.USER + ':' + self.PASSWORD
        auth = bytes.decode(base64.b64encode(auth.encode('utf-8')))
       
        headers = {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'Authorization': 'Basic {}'.format(auth),
        }
       
       worklog = json.dumps({
            'timeSpent':'1h',
            'adjustEstimate':'new',
            'newEstimate':'60h',
            'comment':'add worklog for trial of auto log jira effort'
        })
        res = requests.request(
            'POST',
            url,
            data = worklog,
            headers=headers
        )

1 answer

0 votes
Prince Nyeche
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.
Sep 07, 2022

Hey, you can try returning the response to that 400 error to get a better understanding of what the error message says. That will help you to know what's really wrong.

What is the "returning the response to that 400 error " ?

Prince Nyeche
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.
Sep 18, 2022
print(res.json())
Prince Nyeche
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.
Sep 18, 2022

Do the above in your code on a new line to see what the response is all about.

Great thanks @Prince Nyeche, below are the error msg, seems the adjustEstimate is not supported

{'errorMessages': ['Unrecognized field "adjustEstimate" (Class com.atlassian.jira.issue.fields.rest.json.beans.WorklogJsonBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@cfc7291; line: 1, column: 41] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.WorklogJsonBean["adjustEstimate"])']}

@Prince Nyeche  Do you have more ideas about above error? Seems adjustEstimate is not supported, but this is not aligned with the API user guide for API2  https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-worklogs/#api-rest-api-2-issue-issueidorkey-worklog-post

Prince Nyeche
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.
Sep 27, 2022

You should not use adjustEstimate and newEstimate as body parameters. They should be used as query parameters instead accordingly to the documentation. Therefore, use it as parameters to your url variable.

Like jingga likes this

Great thanks and now according to your suggestions, the interface has been called successfully.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events