# Batch update Variant "inStock" through API

**URL:** https://forum.shopware.com/t/batch-update-variant-instock-through-api/94602
**Category:** Programmierung
**Tags:** general
**Created:** [30. Mai 2022 um 07:41 UTC](https://forum.shopware.com/t/batch-update-variant-instock-through-api/94602 "2022-05-30T07:41:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![emrecanful](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/emrecanful/32/17215_2.png) [@emrecanful](https://forum.shopware.com/u/emrecanful)
#### Post date: [30. Mai 2022 um 07:41 UTC](https://forum.shopware.com/t/batch-update-variant-instock-through-api/94602/1 "2022-05-30T07:41:49Z")

</div>

I cannot update the inStock value of Variants through REST API for some reason. I make a PUT request to the endpoint „/api/variants/“ passing the array of objects with id. HTTP 200 OK response is being returned but the values are not changed. What am I doing wrong?

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/b/f/bf14ae2b787dd2701ad9db986ef2fc6e6eb63127.png)

---

<div class="post-metadata">

### Author: ![chapter2](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@chapter2](https://forum.shopware.com/u/chapter2)
#### Post date: [7. Juni 2022 um 17:23 UTC](https://forum.shopware.com/t/batch-update-variant-instock-through-api/94602/2 "2022-06-07T17:23:59Z")

</div>

Without knowing your PUT payload, i assume you have to add the parameter

```auto
useNumberAsId=true

```

to your queried endpoint. The same applies to the REST Product resource (which, in this case, you could use instead)
