ProjeQtOr free project management software - API returns invalid result when updating Milestones - ProjeQtOr
 

API returns invalid result when updating Milestones

More
01 Aoû 2019 20:24 #1 by phvincent
Hello Team,

I'm using Projeqtor API to manage some reporting features (mainly reading and aggregating database objects such as projects, activities, milestones, etc...).
My customer has a lot of projects and milestones. All of them are regurlaly followed-up by teams and updated according to the default workflow (i.e recorded, assigned, done, closed). Unfortunately, lots of milestones are left in done state and not closed. To avoid the burden of manually closing them in Projeqtor UI, I decided to use the API to massively change state of these old milestones from done to closed stated.

That's where is my current problem: the API always returns an INVALID result, stating that the workflow control prevents me to change the status of milestones.
For example:
Initial milestone attributes are { 'idStatus' : 4, 'doneDate' : "YYYY-MM-DD", 'idle' : 0, 'idleDate' : null, 'result' : null } -- idStatus 4 = "done"
I call API with PUTas follows:
Calling API PUT http://localhost/projeqtor/api/Milestone/
POST data: {"id":35,"idStatus":7,"idle":1,"idleDate":"2019-08-01","result":"Forced closing after 180 days"}

The API result is (PHP encoded):
Array
(
[identifier] => id
[items] => Array
(
[0] => Array
(
[apiResult] => INVALID
[apiResultMessage] => Contrôles invalides. le workflow ne vous autorise pas à passer cet élément dans cet état
[id] => 35
[reference] => -INC-0020
[name] => XXXX
. . .

The same milestone can be successfully closed in Projeqtor UI... so I'm wondering what i'm missing in API regarding the workflow control.
My current Production Projeqtor version is 7.2.7

Thank you for your advice

PVT

Please Connexion or Create an account to join the conversation.

More
02 Aoû 2019 11:11 #2 by babynus
Possibly you don't connect with same user through API as with GUI.
So profile may be different and rights to change workflow may differ.

Babynus
Administrator of ProjeQtOr web site

Please Connexion or Create an account to join the conversation.

More
02 Aoû 2019 21:59 #3 by phvincent
Thank you for replying.

Yes! My fault, I forgot this special feature where one can allow state transitions in the workflows management screen. So I put a check on my API user to allow going from done to close and it's ok.

Cheers

Please Connexion or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.029 seconds