Best way to update EntityState only via REST

31 views
Skip to first unread message

Alexander Solovey

unread,
Nov 21, 2016, 4:52:29 AM11/21/16
to DevTargetProcess
Hi

There was a discussion regarding how to determine the right state id for an entity to change to.
It's also important, but does not cover 2 more things that relate:

- What's the best way to update the state ONLY?
Should I read ENTIRE object of specific type (bug/userstory/etc), change one field (EntityState) and PUT it back?
Or, there is a more lightweight way to do that without reading and writing the ENTIRE object?

- Its there a way to change the state of ANY entity using single logic?
To avoid coding similar but specific code for each entity with unique URL and DTO types

Regards,
Alex

ju...@targetprocess.com

unread,
Nov 22, 2016, 9:10:36 AM11/22/16
to DevTargetProcess
Hi Alex,

There is no need to POST the entire object when you update a filed of an entity.
Here is how you can update EntityState to a state with ID #284 for UserStory with ID #3404:

1. POST to /api/v1/userstories/3404
{EntityState:{Id:284}}

2. POST to /api/v1/userstories
{Id:3404,EntityState:{Id:284}}

3. POST to /api/v1/userstories/bulk
[{Id:3404,EntityState:{Id:284}}]
This option can be used to update several User Stories at once.

4. POST to /api/v1/assignables/3404
{EntityState:{Id:284}}

5. POST to /api/v1/assignables
{Id:3404,EntityState:{Id:284}}
Assignable is a base class for a number of Entity types: https://md5.tpondemand.com/api/v1/Assignables/meta

6. POST to /api/v1/assignables/bulk
[{Id:3404,EntityState:{Id:284}}]
This option can be used to update several Assignables at once.

Hope this helps,
Julia.
Reply all
Reply to author
Forward
0 new messages