# Batching commands using HTTP JSON API

**URL:** <https://forum.canton.network/t/batching-commands-using-http-json-api/4508>\
**Category:** App Development\
**Tags:** features and bugs\
**Created:** [May 11, 2022, 12:06am UTC](https://forum.canton.network/t/batching-commands-using-http-json-api/4508 "2022-05-11T00:06:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [May 11, 2022, 12:06am UTC](https://forum.canton.network/t/batching-commands-using-http-json-api/4508/1 "2022-05-11T00:06:04Z")

</div>

This is a Feature request, but AFAIU, there is no way to batch commands via the HTTP-JSON API. For example, ask it to archive 100 contracts.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [May 11, 2022, 5:11am UTC](https://forum.canton.network/t/batching-commands-using-http-json-api/4508/2 "2022-05-11T05:11:34Z")

</div>

You’re right that there is nothing builtin. However, you can usually emulate that via `createAndExercise`, e.g.,

```haskell
template Helper
  with
    p : Party
  where
    signatory p
    choice ArchiveBatched : ()
      with
        cids : [ContractId T]
      controller p
      do mapA_ archive cids

```

If you then call `ArchiveBatched` via create and exercise you get more or less the same behavior as if you passed multiple archives over the grpc definition. The main downside of this approach is that you have to define the sets of batched command submissions you intend to make upfront in your daml model.

---

<div class="post-metadata">

**Author:** ![Leonid\_Rozenberg](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/leonid_rozenberg/32/48_2.png) [@Leonid\_Rozenberg](https://forum.canton.network/u/Leonid_Rozenberg)\
**Post date:** [May 11, 2022, 11:47am UTC](https://forum.canton.network/t/batching-commands-using-http-json-api/4508/3 "2022-05-11T11:47:59Z")

</div>

I love how the solution to Daml limitations is to write more Daml, `createAnd Exercise` is quickly becoming my favorite action.
