API reference · Contracts
Add Products to the Contract
https://api.sandbox.cws.digital/pricing/contract/{contractId}/itemsDescription
Adds products to the contract with the price of each one, or updates the price of those already in it.
Each product is processed independently: the result of each one comes in the status field of the response.
Send from 1 to 100 products per request.
items[].value is the legacy name of items[].price and is still accepted, with the same effect. When both are sent in the same item, price applies.
How to identify the product
Each product must carry one of the two forms, in this order of precedence:
| Form | Fields | When to use |
|---|---|---|
| By partner code | partnerPartCode | You identify the product by your own code. |
| By attribute | skuAttributeValue with skuAttributeName in the envelope | You have contracted the product catalog service with your own attribute. |
Unlike the stock submission, different forms can coexist in the same submission: each product is resolved by the form it carries.
Parameters
Path parameters
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| contractId | integer | Yes | Contract id, returned in |
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| items | array of object | Yes | From 1 to 100 products. Fields in items[] | |
| skuAttributeName | string | Conditional | Name of the attribute used to resolve |
items[]| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| partnerPartCode | string | No | By partner code. You identify the product by your own code. Case-sensitive. | |
| skuAttributeValue | string | No | By attribute, with | |
| price | number | No | Product price in the contract. Cannot be negative. | |
| targetMargin | number | No | Target margin of the product in the contract, from 0 to 100. | |
| totalCost | number | No | Total cost of the product. Cannot be negative. | |
| priceTypeId | integer | No | Price type to which this product is restricted within the contract. |
Business rules
The product must belong to the store
The product is resolved within the catalog of the store that owns the contract. What does not resolve comes back in notFound.items and the others are stored.
A product repeated in the same submission is not processed
Two products of the same submission that resolve to the same SKU — by the repeated code or by the attribute — both go to notFound.items and neither is stored. Send each product only once per request.
A product rejected by value comes back in the list and does not bring down the submission
Negative price, negative cost, margin outside 0 to 100 and a product without any form of identification are rejected item by item: the product comes back in items with status: ERROR and the reason in error, and the others are stored. The response is 200.