Official comment
Hi Peter,
Please use value "OnHold".
I hope this helps,
Elad
G'day
I am putting a utility together to take a Work Breakdown Structure template in Excel and create the Tasks in Clarizen directly from the Sheet. I have the REST API working, but want to tweak it so that they can update the tasks.
Problem: using the changeState call I can make a task state = "Draft", "Active",... but cannot set it to "On Hold"
making a POST to https://api.clarizen.com/v2.0/services/data/changeState
Payload is: {"ids":["/Task/oim41b575uunk0rk9ghtbed94650"], "state":"On Hold"}
{"errorCode":"Internal","message":"An internal error has occurred, the error was logged and will be examined.","referenceId":"3JaMw06LqkFyntcmZqHR5"}
Have tried many variations on upper and lower cases.
And Note the same call works for 'Active' or 'Draft' State
Pete
Hi Peter,
Please use value "OnHold".
I hope this helps,
Elad
Please sign in to leave a comment.
Hi there.
what is wrong with my syntax? '{"Ids":["\Project\TESTJ006"]},{"state":"Active"}'
Thank you.
Hi,
I assume this is for /V2.0/services/data/changeState
If so, I think the syntax should be:
{
"ids": [
"\Project\TESTJ006"
],
"state": "Active"
}
I hope this helps.
Roland
local procedure ChangeState(CLID: text; NewState: Text)
begin
if NewState = '' then
exit;
mycontenttxt := '{"ids": ["' + CLID + '"],"state": "' + NewState + '"}';
myContent.WriteFrom(myContentTxt);
if myHttpClient.Post(ServerLocation + '/data/changeState', myContenttxt, myResponse) then begin
if not myResponse.IsSuccessStatusCode then
Error('Response says this was not successful %1 %2', myResponse.HttpStatusCode(),
myResponse.ReasonPhrase());
end ELSE
Error('My post did not work.');
end;
actually... my code below had said myContext and NOT myContexttxt... i thought i'd give that a try too. but that won't work because of type mismatch
Hi, which language are you using? I've just tested this in Postman and it worked fine: https://www.screencast.com/t/7HMiPA7Q
I think the problem is in your code. In JS, this would be the correct code I think:
var data = JSON.stringify({
"ids": [
"/Project/33d8mj56td3uj2j4bfzmex3z1548"
],
"state": "Draft"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.clarizen.com/V2.0/services/data/changeState");
xhr.setRequestHeader("Authorization", "Session xxx");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
Best regards,
Roland
Thank you Roland. I'm using AL which is the language used for Microsoft Dynamics Business Central.
I got my code to work!! Finally! I needed to clear MyContent and then switch the \ to / on my project id.