0
注文した後で注文を編集する方法を理解しようとしています。 注文をエクスポートするかどうかにかかわらず、カスタム属性を作成しました。Magento 2 Rest API注文の編集
ステータスがエクスポートされていないオーダーをすべて取得し、エクスポートした後、カスタム属性をエクスポートするように変更したいとします。
注文を編集/更新するためのRESTリクエストとは何ですか?私も試してみました
$json = array(
"entity_id" => $id,
"extension_attributes" => array(
"custom_export_attribute" => "exported",
)
);
$webapi = new ApiClient('https://dev.local.nl', self::$username, self::$password);
$response = $webapi->getClient()->request('PUT', '/rest/V1/orders/create', [
'headers' => [
'Authorization' => "Bearer " . $webapi->getToken(),
'Content-Type' => "application/json"
],
'body' => json_encode($json)
]);
return json_decode($response->getBody(), true);
:これは私のコードです
{"message":"%fieldName is a required field.","parameters":
{"fieldName":"entity"}
:
$webapi->getClient()->request('PUT', '/rest/V1/orders/'.$id,