Create or Update Products in a Batch

This endpoint lets you use the upsert method to create or update products in a batch.

post
Upsert Product Batch

https://api.studio.whisk.com/products/v1/upsert/batch
You can specify the following body parameter to create or update products in Whisk Studio:
Request
Response
Request
Headers
Authentication
required
string
Server token to track down who is emptying our stocks.
Body Parameters
body
required
object
A body object contains multiple product definitions. In each definition, the external_product_id determines whether to update or create a new product. If the identifier already exists in the database, the product information gets updated, and if not, then a new product gets generated. See the Body Object Example below.
Response
200: OK
This is how a successful response looks.
{
"results": [
{
"success": {
"request_id": "string",
"product_id": "string",
"external_product_id": "string"
},
"error": {
"request_id": "string",
"external_product_id": "string",
"error_message": "string"
}
}
]
}
400: Bad Request
This failed response appears when error codes are found in the endpoint query.
{
"error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
"message": "Additional details about error are not static and can be changed"
}
401: Unauthorized
This failed response appears due to API authentication failure. The possible error codes that may appear are: auth.tokenNotFound , auth.tokenExpired, auth.tokenInvalid, auth.tokenRequired.
{
"code": "auth.tokenNotFound"
}
500: Internal Server Error
This failed response appears when something is not right on Whisk's end. Please send a message to help@whisk.com, and be sure to include both the Request and Response data. We’ll get back to you soon.
This is unexpected response, something is wrong on our side, please contact: help@whisk.com

Request Body Object Example

{
"batch":[
{
"request_id":"1",
"payload":{
"external_product_id":"551d2f0b-fba9-43ac-9a4b-7737e53823cf",
"name":"UpdateProduct",
"description":"Updated product description",
"brand":"Whisk",
"language":"en"
}
},
{
"request_id":"2",
"payload":{
"external_product_id":"551d2f0b-fba9-43ac-9a4b-7737e53823cl",
"name":"NewProduct",
"description":"New product",
"brand":"Whisk",
"language":"en"
}
}
],
"integration_id":"e07032d4-ab74-4736-ae84-57091fae6210"
}

The body object contains the following attributes that you can specify to create or update products:

Attribute

Type

Description

Example

batch

array

It contains a group of definitions to update or create products.

{ "batch": [ { "request_id": "1", "payload": { ... }

},

{ "request_id": "2", "payload": { ... }

} ], }

integration_id

string

An identifier to indicate the integration type. See Integration API for more information.

e07032d4-ab74-4736-ae84-57091fae6210

The batch object contains the following attributes:

Attribute

Type

Description

Example

request_id

string

An identifier for each product data submission request.

"request_id": "2",

payload

object

It contains individual product definitions for either data creation or update. To understand the data structure of a product definition, see the Product Object.

"payload":{ "external_product_id":"551d2f0b-fba9-43ac-9a4b-7737e53823cf", "name":"UpdateProduct", "description":"Updated product description", "brand":"Whisk", "language":"en" }

Sample Request and Response

Curl Request
Response
Curl Request
curl -X POST "https://api.studio.whisk.com/products/v1/upsert/batch"
-H "Accept: application/json"
-H "Authorization: Bearer <YOUR-API-ACCESS-KEY>"
-H "Content-Type: application/json"
-d "{ \"batch\":[ { \"request_id\":\"1\", \"payload\":{ \"external_product_id\":\"551d2f0b-fba9-43ac-9a4b-7737e53823cf\", \"name\":\"UpdateProduct\", \"description\":\"Updated product description\", \"brand\":\"Whisk\", \"language\":\"en\" } }, { \"request_id\":\"2\", \"payload\":{ \"external_product_id\":\"551d2f0b-fba9-43ac-9a4b-7737e53823cl\", \"name\":\"NewProduct\", \"description\":\"New product\", \"brand\":\"Whisk\", \"language\":\"en\" } } ], \"integration_id\":\"e07032d4-ab74-4736-ae84-57091fae6210\"}"

Note: Whisk allows you to discover and understand its API capabilities on the Swagger interface with the ability to try out the API calls directly in your browser. You can call this endpoint here.

Response
{
"results": [
{
"success": {
"request_id": "1",
"product_id": "5ff46349642e29bec3731026",
"external_product_id": "551d2f0b-fba9-43ac-9a4b-7737e53823cf"
}
},
{
"success": {
"request_id": "2",
"product_id": "5ff4671f642e29bec3777d76",
"external_product_id": "551d2f0b-fba9-43ac-9a4b-7737e53823cl"
}
}
]
}