# Data consistency for multiple & connected REST api calls?

**URL:** <https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715>\
**Category:** REST API\
**Created:** [August 17, 2020, 12:29pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715 "2020-08-17T12:29:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrey](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@shrey](https://community.parseplatform.org/u/shrey)\
**Post date:** [August 17, 2020, 12:29pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715/1 "2020-08-17T12:29:29Z")

</div>

Hello all.

Could anyone here help me with the following question (in the context of REST api calls):  
e.g. I save a parse object and update the count (which is stored as a separate parse object) in afterSave method. What happens if the saving of the object succeeds but the update of the count fails?  
How is data consistency ensured in such cases?

Thanks.

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [August 17, 2020, 11:36pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715/2 "2020-08-17T23:36:23Z")

</div>

I’d try to ensure an atomic operation by sending a [batch request](https://docs.parseplatform.org/rest/guide/#batch-operations) with both operations together and the flag `transaction: true`

---

<div class="post-metadata">

**Author:** ![yomybaby](https://community.parseplatform.org/user_avatar/community.parseplatform.org/yomybaby/32/87_2.png) [@yomybaby](https://community.parseplatform.org/u/yomybaby)\
**Post date:** [November 20, 2020, 10:18pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715/3 "2020-11-20T22:18:22Z")

</div>

Is there any doc or example of `transaction: true`?

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [November 20, 2020, 10:19pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715/4 "2020-11-20T22:19:27Z")

</div>

Not yet. But you can see some examples in the test cases: [https://github.com/parse-community/parse-server/blob/master/spec/batch.spec.js](https://github.com/parse-community/parse-server/blob/master/spec/batch.spec.js)

---

<div class="post-metadata">

**Author:** ![yomybaby](https://community.parseplatform.org/user_avatar/community.parseplatform.org/yomybaby/32/87_2.png) [@yomybaby](https://community.parseplatform.org/u/yomybaby)\
**Post date:** [November 20, 2020, 10:23pm UTC](https://community.parseplatform.org/t/data-consistency-for-multiple-connected-rest-api-calls/715/5 "2020-11-20T22:23:26Z")

</div>

Thanks for replying 👍
