The Add Product to Catalog command allows you to add a product and details to a catalog.
POST /product
https://[siteurl]/rest/product
Request Body Parameters
The Add Product to Catalog command requires the URI call with the Catalog ID and Product ID. The command requires the following in the Posted JSON:
- Catalog ID : "catalogId": ["string"]
- Product ID : "productId": ["string"]
- Status : "active": [0,N,n,1,Y,y]
- Availability : "availability": ["string"]
- VSKU : "vsku": ["string"]
- PSKU : "psku": ["string"]
- Product Type : "productType": ["string > string"]
- Title : "title": ["string"]
- Link : "link": ["URL"]
- Image Link : "imageLink": ["URL"]
- Price : "price": [float]
- Currency : "currency": ["string"]
All other POST-able fields are optional:
- Variant Title : "variantTitle": "[string]"
- Brand: "brand": "[string]"
- Manufacturer: "manufacturer": "[string]"
- Quantity: "quantity": [integer]
- Color: "color": "[string]"
- Size: "size": "[string]"
- Gender: "gender": "[string]"
Request Body Example
Using Add Product to Catalog with all arguments, line breaks in JSON for readability:
curl --request POST \
--url 'https://mail.mydomain.com/rest/product' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'content-type: application/json' \
--header 'accept: application/vnd.whatcounts-v1+json' \
'{
"productId": "2020ABCxyz",
"catalogId": 68,
"active": 1,
"availability": "New In stock",
"psku": "ABC",
"vsku": "xyz",
"productType": "New Paper > Copy Paper",
"title": "Copy Paper ABC",
"variantTitle": "Copy Paper xyz",
"link": "http://www.mydomain.com/ABCxyz",
"imageLink": "http://www.mydomain.com/ABCxyz.png",
"price": 44.44,
"currency": "USD",
"brand": "2020",
"manufacturer": "My Brand",
"quantity": 64,
"color": "white",
"size": "8.5x11",
"gender": "none"
}' \
--include
Response Body
The response returns JSON or an HTTP status code. Based on the example above, the response returns:
HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Content-Length: 456
Date: Fri, 16 Mar 2020 12:54:44 GMT
{
"productId": "2020ABCxyz",
"catalogId": 68,
"active": 1,
"availability": "New In stock",
"psku": "ABC",
"vsku": "xyz",
"productType": "New Paper > Copy Paper",
"title": "Copy Paper ABC",
"variantTitle": "Copy Paper xyz",
"link": "http://www.mydomain.com/ABCxyz",
"imageLink": "http://www.mydomain.com/ABCxyz.png",
"price": 44.44,
"currency": "USD",
"brand": "2020",
"manufacturer": "My Brand",
"quantity": 64,
"color": "white",
"size": "8.5x11",
"gender": "none"
}
Error Response
Error Response Codes include both Client Errors (4xx) and Server Errors (5xx). Descriptions of each can be found in Response Codes. An error will occur if Product ID or Catalog ID are blank, or a Product with the same ID already exists.
For example, if a the Product ID is invalid the error would appear as:
{
"error": "The Product's ID cannot be empty.",
"status": "Internal Server Error",
"statusCode": 500
}
Feature added in v15.14.00