Forums

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

Cannot create worklog with OAuth

nkhitrov July 15, 2019

I used example from documentation and it work good in curl with basic auth. But it dont work with OAuth. 
Documentation says "OAuth scopes requiredwrite:jira-work" 
so, it should work. Is it bug or something else?

Doc: https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-worklog-post

Response
Url: https://api.atlassian.com/ex/jira/<cloud_id>/rest/api/3/TES-22/worklog)
Status code: 403
JSON:

{'errorMessages': ['OAuth 2.0 is not enabled for this method.']}

 

2 answers

1 accepted

0 votes
Answer accepted
nkhitrov July 16, 2019

I found solution, it was very simple. I forget add 'issue' in url

My url: rest/api/3/{issueIdOrKey}/worklog)
In Doc: /rest/api/3/issue/{issueIdOrKey}/worklog

But i found really (no critical) bug. Jira send 500 error.

Good Request from doc example:


{ "timeSpentSeconds": 50000, "comment": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [{"text": "I did some work here.", "type": "text"}], } ], }, "started": "2019-07-15T14:59:25.551+0000"}

Bad request from python code:

{ "timeSpentSeconds": 10000, "comment": { "type": "doc", "version": 1, "content": [ {"type": "paragraph", "content": [{"text": "api test", "type": "text"}]} ], }, "started": "2019-07-16T12:05:11.959043"}

They have different started time format. In python i used .isoformat() of datetime class.

14:59:25.551+0000

12:05:11.959043


Headers:

'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Type': 'application/json;charset=UTF-8', 
'Strict-Transport-Security': 'max-age=315360000; includeSubDomains; preload', 'Date': 'Tue, 16 Jul 2019 08:26:56 GMT',
'X-AACCOUNTID': '5cbd6a4f4253ab0e29343737', 'X-AREQUESTID': 'a29a4735-3de0-4f6b-9162-31b45af75542',
'X-Application-Context': 'Stargate:prod,prod-eucentral:8080', 'X-XSS-Protection': '1; mode=block', 'Timing-Allow-Origin': '*',
'Transfer-Encoding': 'chunked', 'X-Content-Type-Options': 'nosniff', 'X-Failure-Category': 'ORIGIN', 'Connection': 'close', 'X-Frame-Options': 'SameOrigin'


Log:


2019-07-16 11:32:43.328 | ERROR | app.jira.api:create_worklog:204 - response error: 500; {'errorMessages': ['Внутренняя ошибка сервера'], 'errors': {}}

Thomas Deiler
Community Champion
July 17, 2019

Dear @nkhitrov ,

can you raise this bug here? https://ecosystem.atlassian.net/servicedesk/customer/portal/14

So long

Thomas

nkhitrov July 17, 2019

Dear @Thomas Deiler ,

Done. Ticket name - DEVHELP-3126

1 vote
Thomas Deiler
Community Champion
July 15, 2019

Dear @nkhitrov ,

probably this post brings the solution.

So long

Thomas

nkhitrov July 15, 2019

Thank you, @Thomas Deiler .

Unfortunately, this post has not solution.

Suggest an answer

Log in or Sign up to answer