Forum

API returns invalid...
 
Notifications
Retirer tout

API returns invalid result when updating Milestones

3 Posts
2 Utilisateurs
0 Reactions
2,021 Vu
VINCENT Philippe
(@phvincent)
Posts: 11
Eminent Member
Début du sujet
 
[#6165]

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


 
Posté : 01/08/2019 10:24 pm
(@babynus)
Posts: 14952
Membre Admin
 

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.


 
Posté : 02/08/2019 1:11 pm
VINCENT Philippe
(@phvincent)
Posts: 11
Eminent Member
Début du sujet
 

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


 
Posté : 02/08/2019 11:59 pm
Share:
Retour en haut