Add or update product cost. Input item should correspond to \Magento\Catalog\Api\Data\CostInterface. If any items will have invalid cost, store id or sku, they will be marked as failed and excluded from update list and \Magento\Catalog\Api\Data\PriceUpdateResultInterface[] with problem description will be returned. If there were no failed items during update empty array will be returned. If error occurred during the update exception will be thrown.
application/json
POST
/V1/products/cost
cURL (application/json)
curl \
--request POST 'https://magento2.winkelstraat.mac/rest/all/V1/products/cost' \
--header "Content-Type: application/json" \
--data '{"prices":[{"cost":42.0,"store_id":42,"sku":"string","extension_attributes":{}}]}'
curl \
--request POST 'https://magento2.winkelstraat.mac/rest/all/V1/products/cost' \
--header "Content-Type: application/xml"
Request examples
{
"prices": [
{
"cost": 42.0,
"store_id": 42,
"sku": "string",
"extension_attributes": {}
}
]
}
Request examples
<?xml version="1.0" encoding="UTF-8"?>
<root>
<prices type="array">
<price>
<cost type="float">42.0</cost>
<store-id type="integer">42</store-id>
<sku>string</sku>
<extension-attributes>
</extension-attributes>
</price>
</prices>
</root>
Response examples (200)
[
{
"message": "string",
"parameters": [
"string"
],
"extension_attributes": {}
}
]
Response examples (200)
<?xml version="1.0" encoding="UTF-8"?>
<root type="array">
<root>
<message>string</message>
<parameters type="array">
<parameter>string</parameter>
</parameters>
<extension-attributes>
</extension-attributes>
</root>
</root>
Response examples (401)
{
"message": "string",
"errors": [
{
"message": "string",
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
]
}
],
"code": 42,
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
],
"trace": "string"
}
Response examples (401)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<message>string</message>
<errors type="array">
<error>
<message>string</message>
<parameters type="array">
<parameter>
<resources>string</resources>
<fieldName>string</fieldName>
<fieldValue>string</fieldValue>
</parameter>
</parameters>
</error>
</errors>
<code type="integer">42</code>
<parameters type="array">
<parameter>
<resources>string</resources>
<fieldName>string</fieldName>
<fieldValue>string</fieldValue>
</parameter>
</parameters>
<trace>string</trace>
</root>
Response examples (default)
{
"message": "string",
"errors": [
{
"message": "string",
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
]
}
],
"code": 42,
"parameters": [
{
"resources": "string",
"fieldName": "string",
"fieldValue": "string"
}
],
"trace": "string"
}
Response examples (default)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<message>string</message>
<errors type="array">
<error>
<message>string</message>
<parameters type="array">
<parameter>
<resources>string</resources>
<fieldName>string</fieldName>
<fieldValue>string</fieldValue>
</parameter>
</parameters>
</error>
</errors>
<code type="integer">42</code>
<parameters type="array">
<parameter>
<resources>string</resources>
<fieldName>string</fieldName>
<fieldValue>string</fieldValue>
</parameter>
</parameters>
<trace>string</trace>
</root>