Update EntityState from rest service

56 views
Skip to first unread message

Alessandro Donisi

unread,
Jun 2, 2016, 8:44:54 PM6/2/16
to DevTargetProcess
If I want to update EntityState (for a UserStory or bug for example) from rest service, what is the best approach to get EntityState Ids ? Can we do it by name?

Regards

zh...@targetprocess.com

unread,
Jun 6, 2016, 7:06:16 AM6/6/16
to DevTargetProcess
Hello Alessandro Donisi,

Actually we do not have special service or command to update state by name. So you need to find out a proper entityState.id.

From any assignable you can get its entityType.id and workflow.id for e.g. by following request

/api/v1/assignables?include=[entityState[workflow],entityType]

as a response you may get smth like

<Assignables>
 
<Assignable ResourceType="Assignable" Id="209">
     
<EntityType Id="4" Name="UserStory"/>
     <EntityState Id="73">
       <Workflow Id="10" Name="Project workflow"/>
     </EntityState>
 
</Assignable>
 
<Assignable ResourceType="Assignable" Id="218">
   
<EntityType Id="8" Name="Bug"/>
     <EntityState Id="93">
       
<Workflow Id="12" Name="Project workflow"/>
     
</EntityState>
 
</Assignable>
</Assignables>

suppose you get workflow id equal to 10 and entityType equal to 4 (UserStory) and you looking for state with name 'Planned'

/api/v1/entityStates?where=(entitytype.id eq 4)and(workflow.id eq 10)and(name eq 'Planned')

so in a result you may get the following

<EntityStates>
 
<EntityState Id="74" Name="Planned">
   
<IsInitial>false</IsInitial>
   
<IsFinal>false</IsFinal>
   
<IsPlanned>false</IsPlanned>
   
<IsCommentRequired>false</IsCommentRequired>
   
<NumericPriority>74</NumericPriority>
   
<EntityType Id="4" Name="UserStory"/>
   
<Role Id="1" Name="Developer"/>
   
<Process Id="3" Name="Scrum"/>
   
<ParentEntityState nil="true"/>
   
<Workflow Id="10" Name="Project workflow"/>
 
</EntityState>
</EntityStates>


Be aware that entity state is unique across {process, entityType, name} triple, so Planned state for Bug is not equal to Planned state for UserStory even in same process.

Best Regards

Alex Fomin

unread,
Jun 6, 2016, 9:21:48 AM6/6/16
to DevTargetProcess, zh...@targetprocess.com
Also you can include NextStates to the states call, like
/api/v1/Assignables?include=[EntityState[Name,NextStates]]

And receive all possible next states with Ids for particular entity - process/entityType/workflow aware:
<Assignable ResourceType="Assignable" Id="61" Name="Data Cert Customizations">
<EntityType Id="9"/>
<EntityState Id="95" Name="Done">
<NextStates>
<EntityState Id="87" Name="Open">
<NumericPriority>1</NumericPriority>
</EntityState>
<EntityState Id="777" Name="Planned">
<NumericPriority>3</NumericPriority>
</EntityState>
<EntityState Id="2655" Name="Analysis">
<NumericPriority>3.5</NumericPriority>
</EntityState>
<EntityState Id="2656" Name="UX">
<NumericPriority>3.75</NumericPriority>
</EntityState>
<EntityState Id="2657" Name="UX Ready">
<NumericPriority>3.875</NumericPriority>
</EntityState>
<EntityState Id="1573" Name="In Dev">
<NumericPriority>4</NumericPriority>
</EntityState>
</NextStates>
</EntityState>
</Assignable>

Alessandro Donisi

unread,
Jul 10, 2016, 9:22:09 PM7/10/16
to DevTargetProcess, zh...@targetprocess.com
Thank you

Alessandro Donisi

unread,
Jul 10, 2016, 9:22:26 PM7/10/16
to DevTargetProcess, zh...@targetprocess.com
Thank you
Reply all
Reply to author
Forward
0 new messages