# Comment passer un tableau à l'API

**URL:** <https://meta.discourse.org/t/how-do-you-pass-an-array-to-the-api/121598>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [Juin 28, 2019, 4:57 UTC](https://meta.discourse.org/t/how-do-you-pass-an-array-to-the-api/121598 "2019-06-28T16:57:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [Juillet 1, 2019, 6:17 UTC](https://meta.discourse.org/t/how-do-you-pass-an-array-to-the-api/121598/2 "2019-07-01T18:17:17Z")

</div>

Bonne question, je conviens que cela peut prêter à confusion. Si vous souhaitez transmettre plusieurs post\_ids, vous devez inclure plusieurs champs de formulaire pour `post_ids[]`, comme dans l’exemple curl ci-dessous :

```plaintext
curl -i -sS -X POST "http://localhost:8080/t/15/change-owner.json" 
-H "Api-Key: api-key" \
-H "Api-Username: system" \
-F "username=blake" \
-F "post_ids[]=29" \
-F "post_ids[]=30"

```

---

_[View the full topic](https://meta.discourse.org/t/how-do-you-pass-an-array-to-the-api/121598)._
