# Preise per API aktualisieren

**URL:** https://forum.shopware.com/t/preise-per-api-aktualisieren/61063
**Category:** Programmierung
**Created:** [14. August 2019 um 06:49 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063 "2019-08-14T06:49:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ebcom](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@ebcom](https://forum.shopware.com/u/ebcom)
#### Post date: [14. August 2019 um 06:49 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/1 "2019-08-14T06:49:05Z")

</div>

Versuche Preise per API zu aktualisieren, bekomme es jedoch mit folgenden Daten nicht hin:

```
 $d = array( "stock"=\> rand(1,100), "price"=\> [["currencyId"=\> "b7d2554b0ce847cd82f3ac9bd1c0dfca", "net"=\> 1, "gross"=\> 1.19, "linked"=\> true]] );

```

Methode: POST bzw. PATCH (keines funktioniert)

URI: product/251448b91bc742de85643f5fccd89051

&nbsp;

---

<div class="post-metadata">

### Author: ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)
#### Post date: [14. August 2019 um 09:32 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/2 "2019-08-14T09:32:08Z")

</div>

Hallo ebcom,

bekommst du eine Fehlermeldung zurück?

Viele Grüße aus Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

### Author: ![ebcom](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@ebcom](https://forum.shopware.com/u/ebcom)
#### Post date: [14. August 2019 um 12:10 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/3 "2019-08-14T12:10:18Z")

</div>

```
 Hallo, ich bekomme folgende Fehlermeldung zurück: Array ( [errors] =\> Array ( [0] =\> Array ( [code] =\> c1051bb4-d103-4f74-8988-acbcafc7fdc3 [status] =\> 400 [detail] =\> This value should not be blank. [template] =\> This value should not be blank. [parameters] =\> Array ( [{{ value }}] =\> null ) [source] =\> Array ( [pointer] =\> /0/prices/0/ruleId ) ) [1] =\> Array ( [code] =\> c1051bb4-d103-4f74-8988-acbcafc7fdc3 [status] =\> 400 [detail] =\> This value should not be blank. [template] =\> This value should not be blank. [parameters] =\> Array ( [{{ value }}] =\> null ) [source] =\> Array ( [pointer] =\> /0/prices/0/price ) ) [2] =\> Array ( [code] =\> c1051bb4-d103-4f74-8988-acbcafc7fdc3 [status] =\> 400 [detail] =\> This value should not be blank. [template] =\> This value should not be blank. [parameters] =\> Array ( [{{ value }}] =\> null ) [source] =\> Array ( [pointer] =\> /0/prices/0/quantityStart ) ) ) )
```

---

<div class="post-metadata">

### Author: ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)
#### Post date: [14. August 2019 um 12:31 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/4 "2019-08-14T12:31:49Z")

</div>

Hallo,

gegen welchen Endpunkt schickt du denn deinen Request? Ein PATCH Call gegen&nbsp;/api/v1/product/ geht bei mir erfolgreich durch. Folgende JSON Payload sende ich mit:

```
{
  "price": [
    {
      "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
      "gross": 300,
      "net": 100,
      "linked": false
    }
  ]
}

```

Also eigentlich so wie du es wegschickst.

Viele Grüße aus Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

### Author: ![ebcom](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@ebcom](https://forum.shopware.com/u/ebcom)
#### Post date: [14. August 2019 um 14:40 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/5 "2019-08-14T14:40:05Z")

</div>

Hallo,

Endpunkt ist&nbsp;

```
 /api/v1/product/UUID\_DES\_ARTIKELS
```

---

<div class="post-metadata">

### Author: ![ebcom](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@ebcom](https://forum.shopware.com/u/ebcom)
#### Post date: [14. August 2019 um 15:28 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/6 "2019-08-14T15:28:26Z")

</div>

Jetzt hat es&nbsp;fuktioniert, ich hatte bei meinen Tests noch die id im Satz stehen.

---

<div class="post-metadata">

### Author: ![ahmadsaad](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@ahmadsaad](https://forum.shopware.com/u/ahmadsaad)
#### Post date: [16. Februar 2021 um 13:26 UTC](https://forum.shopware.com/t/preise-per-api-aktualisieren/61063/7 "2021-02-16T13:26:19Z")

</div>

Hallo [@Michael Telgmann]([http://forum.shopware.com/profile/17553/Michael](http://forum.shopware.com/profile/17553/Michael) Telgmann “Michael Telgmann”)‍

Ich weiß, dass dies ein alter Post ist.

aber warum die API den Nettopreis nicht automatisch berechnet wie beim Shopware 5 .

jetzt wie ich sehe ich habe zwei Lösung:

1- ein einige Code entwicklen um der Nettepreis zu berchenen.

2- beim jeden Preis ein API Request zu ‘/api/v2/\_action/calculate-price’&nbsp; um jeden Price zu brechen.

also z.b 1 Artikel hat 6 Preise ( 1 pro Währung ) dann ich darf&nbsp;6 mal das API anrufen um die nettoPreise zu berchenen

also wenn ich habe 1000 Artikels , dann ich brauche 6000 extra Api Request und dass nur für die NettoPreise zu brechenen.

gibt ein andere Lösung um das zu machen ? und wenn nicht, ist die&nbsp;automatisch Berechnung ist in das Plan für die nächste Versions.

VG,

Ahmad
