Hello,
I need to create a script that automates logging time in tickets. I have a problem, at our company we have a JIRA that we can connect trough WorklogPRO Apiary, im reffering to:
But any script that I try to use returns me 200 and never 201. I can see in the response that it sees my account and it connected but it never creates nothing. I tries to use both script in Python 3 and in Python 2 as the Apiary documentation speaks only about Python 2, but both give the same result
I would really be grateful if you could help me with this problem. I don’t know what the matter is. If I am missing something in the workLogAttributes
, I think it should tell me that in the error instead of just giving back a 200 status code. Maybe someone has encountered something similar in the past.
Best regards
My code in Python 3:
from urllib.request import Request, urlopen
import json
from datetime import datetime
values = json.dumps({
"issueKey": "{ISSUEKEY}",
"workStart": "2025-01-09T00:00:00+0000",
"timeSpent": 3600,
"comment": "this is *comment*",
"adjustEstimate": "auto",
"workLogAttributes": [
{
"attrTypeId": 1,
"attrValue": "{ATTRVALUE}"
}
]
})
headers = {
"Authorization": f"Bearer {API TOKEN}",
"Content-Type": "application/json"
}
request = Request('http://jira.{MY COMPANY}/rest/com.deniz.jira.worklog/1.0/worklog', data=values.encode('utf-8'), headers=headers)
response_body = urlopen(request).read()
print(response_body)