Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

API returns invalid...
 
Notifications
Clear all

API returns invalid result when updating Milestones

3 Posts
2 Users
0 Reactions
2,049 Views
VINCENT Philippe
(@phvincent)
Posts: 11
Active Member
Topic starter
 
[#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


 
Posted : 01 Aug 2019 22H24
babynus
(@babynus)
Posts: 14966
Main Contributor 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.


 
Posted : 02 Aug 2019 13H11
VINCENT Philippe
(@phvincent)
Posts: 11
Active Member
Topic starter
 

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


 
Posted : 02 Aug 2019 23H59
Share:

Scroll to Top