ebcomebcom MemberComments: 4 Received thanks: 0 Member since: August 12

Beim erstellen eines Artikels per API bekomme ich folgende Fehlermeldung zurück:

500 Internal Server Error` response: {"errors":[{"code":"0","status":"500","title":"Internal Server Error","detail":"Cannot unset string offsets"}]}

Requests zum ändern und lesen klappen einwandfrei.

Folgender Programmcode wird verwendet:

$d = array(
    "active"=> true,
    "stock"=> 100,
    "taxId"=> "0214fcd221484b7b94e3c1f6537afd5a",
    "price"=> [
        "currencyId"=> "b7d2554b0ce847cd82f3ac9bd1c0dfca",
        "net"=> 1,
        "linked"=> true,
        "gross"=> 1.07
    ],
    "productNumber"=> "8888",
    "name"=> "TTTTTTTTTTTTTTTTTTTTTTTTTTTTT",
    "id"=> $this->getUUID(),
    "createdAt"=> null,
    "readOnly"=> true,
    "updatedAt"=> null
);

 

$this->getAdminAccess();
$request = $this->createShopwareApiRequest("POST", "product",$d);
$response = $this->restClient->send($request);
$pp = json_decode($response->getBody()->getContents(), true);

Answers

  • ebcomebcom MemberComments: 4 Received thanks: 0 Member since: August 12

    Fehler gefunden, der Preis gehört in doppelte Arrays:

     

    $d = array(
        "active"=> true,
        "stock"=> 100,
        "taxId"=> "0214fcd221484b7b94e3c1f6537afd5a",
        "price"=> [[
            "currencyId"=> "b7d2554b0ce847cd82f3ac9bd1c0dfca",
            "net"=> 1,
            "linked"=> true,
            "gross"=> 1.07
        ]],
        "productNumber"=> "8888",
        "name"=> "TTTTTTTTTTTTTTTTTTTTTTTTTTTTT",
        "id"=> $this->getUUID(),
        "createdAt"=> null,
        "readOnly"=> true,
        
Sign In or Register to comment.