POST /V1/products/cost

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.

Body

  • prices array[object] Required
    Hide prices attributes Show prices attributes object

    Cost interface.

    • cost number Required

      Cost value.

    • store_id integer Required

      Store id.

    • sku string Required

      SKU.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\CostInterface

Body

  • prices array[object] Required
    Hide prices attributes Show prices attributes object

    Cost interface.

    • cost number Required

      Cost value.

    • store_id integer Required

      Store id.

    • sku string Required

      SKU.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\CostInterface

Responses

  • 200 Success.

    Hide response attributes Show response attributes object
    • message string Required

      Error message, that contains description of error occurred during price update.

    • parameters array[string] Required

      Parameters, that could be displayed in error message placeholders.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\PriceUpdateResultInterface

    Hide response attributes Show response attributes object
    • message string Required

      Error message, that contains description of error occurred during price update.

    • parameters array[string] Required

      Parameters, that could be displayed in error message placeholders.

    • extension_attributes object

      ExtensionInterface class for @see \Magento\Catalog\Api\Data\PriceUpdateResultInterface

  • 401 Unauthorized

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • Unexpected error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

POST /V1/products/cost
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>