Update customstatus of task using api in combination with powershell Invoke-WebRequest
Hi,
I'm trying to update the customStatus of a task using a powershell script with the cmdlet Invoke-WebRequest.
Here is my code:
$headers=@{}
$headers.Add("Authorization", "bearer XX123sometoken321XX")
$headers.Add("Content-Type", "application/x-www-form-urlencoded")
$Body = '{customStatus=ABCDEJMCL6B4A}'
$response = Invoke-WebRequest -Uri 'https://app-eu.wrike.com/api/v4/tasks/AGRTFDSSSSST' -Method PUT -Headers $headers -Body $Body
But I receive the follwoing error:
Invoke-WebRequest : {"errorDescription":"Parameter '{customStatus' is not allowed","error":"invalid_request"}
Can anyone point in the direction of what I'm missing or which part of the code ist wrong?
Thanks,
Sebastian
Hi Sebastian Kauert, welcome to the Community 👋
I've asked our Support team to look into your question 👍
Please let me know if you have any other questions or feedback!
Lisa Community Team at Wrike Wrike Product Manager Conviértete en un experto en Wrike con Wrike Discover
Lisa Wrike Team member Conviértete en un experto en Wrike con Wrike Discover
Hi Lisa, thanks I got it now changed so I don't receive an error message anymore but my status won't change when I run the update with powershell.
I also tried it with the curl code directly provided from the developer (https://curl.se/windows/) and the statement provided on your api description page https://developers.wrike.com/api/v4/tasks/ but there is no change the status is not updated. :-(
$headers=@{
"Authorization" = "bearer myToken"
}
$body = @{"customStatus"="mycustomStatusID"} | ConvertTo-Json
Invoke-WebRequest -Uri 'https://app-eu.wrike.com/api/v4/tasks/MyTaskID' -Method PUT -Headers $headers -Body $body
Thanks for sharing Sebastian Kauert, I've pinged our Support team on this so they can further assist 👍
Elaine Community Team at Wrike Wrike Product Manager Conviértete en un experto de Wrike con Wrike Discover
Elaine Wrike Team member Conviértete en un experto de Wrike con Wrike Discover