i'm attempting to log work via the api and powershell
making data with:
$datablob = @{timespent="1h 30m";timeSpentSeconds="5400";comment="logging via powershell";started="2013-09-16T11:29:49.743-0700"} | ConvertTo-Json
which generates:
{
"timeSpentSeconds": "5400",
"timespent": "1h 30m",
"started": "2013-09-01T10:30:18.932+0530",
"comment": "logging via powershell"
}
then calling
$result = Invoke-RestMethod -Method POST -Headers $header -Uri http://myjira.company.com/rest/api/2/issue/ISSUE-238/worklog -ContentType application/json -Body $datablob
i keep getting back 400 Bad Request errors.
Anyone see where i've gone wrong?
Community moderators have prevented the ability to post new answers.
Figured it out. So painful.
I had the capitalization wrong on timeSpent, also timeSpentSeconds isn't needed
correct json block:
{
"timeSpent": "1h 30m",
"started": "2013-09-01T10:30:18.932+0530",
"comment": "logging via powershell"
}
Can you please post the complete request you were able to create, alongwith the json..The documentations and posts are making me wandering here and there..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
400 means
Returned if the input is invalid (e.g. missing required fields, invalid values, and so forth).
Have you tried to follow the exact POST body here (https://docs.atlassian.com/jira/REST/latest/#idp2062512)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't yet tried the full JSON body as I understood it wasn't all required, maybe that's wrong.
I'll give it a try but i'm not sure how to know what to set for the self and id elements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.