# Update Case and Activity after successful  PUT state not changing

**URL:** <https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115>\
**Category:** Q&A\
**Created:** [13 April 2020 12:57 UTC](https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115 "2020-04-13T12:57:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![burimameti2001\_14232](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@burimameti2001\_14232](https://community.ofelia.com/u/burimameti2001_14232)\
**Post date:** [13 April 2020 12:57 UTC](https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115/1 "2020-04-13T12:57:36Z")

</div>

Hello,&nbsp;

I am using rest API and I have a problem changing the state of case and activity. Also, I am in need of information or code snippet on how to claim the task on JavaScript.&nbsp;

I use Living Application example but not able to claim the Human task, Query Activity, and Case State after the update,&nbsp; &nbsp;

For now, I just can make the activity Completed, but when I try another state, the response gives 200 but state activity remains on executing. Please clear me what is the difference between this state executing and state that I want to assign.&nbsp;

How to query those activity states and see what is it updated&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [13 April 2020 13:34 UTC](https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115/2 "2020-04-13T13:34:14Z")

</div>

Hi,&nbsp;

Bonita provides some REST API's to read and update activities&nbsp;  
-\>&nbsp;[https://documentation.bonitasoft.com/bonita/7.11/bpm-api#toc0](https://documentation.bonitasoft.com/bonita/7.11/bpm-api#toc0)  
  
The REST API to use is always&nbsp;&nbsp;_`/API/bpm/activity/:id`_

Perform a GET to read the state of an activity, and put to update it.  
  
For human tasks, it is almost the same but with thew API&nbsp;&nbsp;`/API/bpm/humanTask/:taskId`  
Keep in mind that if you'll have to pass the contract to the API payload to update it.&nbsp;  
  
  
regards,&nbsp;  
Adrien

&nbsp;

---

<div class="post-metadata">

**Author:** ![burimameti2001\_14232](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@burimameti2001\_14232](https://community.ofelia.com/u/burimameti2001_14232)\
**Post date:** [13 April 2020 14:01 UTC](https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115/3 "2020-04-13T14:01:08Z")

</div>

&nbsp;you saying to execute this order of calls&nbsp;

1.Login service post

2.Session Get

3.Activitity state Get&nbsp;

4. Activity state PUT&nbsp;

Correct me if I am wrong&nbsp;

For the human task, I have a contract with persistence id and bool true false&nbsp; if the task is done or not&nbsp;

How to claim the task from the case and then execute this contract&nbsp; make it done&nbsp;

Thanks,&nbsp;Burim&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [13 April 2020 14:25 UTC](https://community.ofelia.com/t/update-case-and-activity-after-successful-put-state-not-changing/10115/4 "2020-04-13T14:25:49Z")

</div>

I re checked the documentation to be sure, so here is what you have to do to assign and then execute a task.&nbsp;  
It seems that it's better to use the REST API _userTask&nbsp;_to send a contract, I forgot that in my previous answer, sorry.  
  
**1 - assign&nbsp;**

- **URL**  
`/API/bpm/userTask/:userTaskId`
- **Method**  
`PUT`
- **Request Payload**

```
{
  "assigned_id" : "id of new user"
}
```

**2 - execute&nbsp;**

- **URL**  
`/API/bpm/userTask/:userTaskId/execution`
- **Method**  
`POST`
- **Request Payload**  
 A JSON object matching task contract. Execute a task providing correct contract values. 

```
{  
  "ticket_comment":"This is a comment"
}
```

&nbsp;

&nbsp;
