Update variants in bulk
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"id": "<string>",
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": true,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update"
payload = [
{
"id": "<string>",
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": True,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
id: '<string>',
packaging: {
pack_width: 123,
pack_height: 123,
pack_length: 123,
pack_dry_weight: 123,
units_per_pack: 123,
vertical_rotation: true,
shipper_width: 123,
shipper_height: 123,
shipper_length: 123,
shipper_dry_weight: 123,
units_per_shipper: 123
}
}
])
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => '<string>',
'packaging' => [
'pack_width' => 123,
'pack_height' => 123,
'pack_length' => 123,
'pack_dry_weight' => 123,
'units_per_pack' => 123,
'vertical_rotation' => true,
'shipper_width' => 123,
'shipper_height' => 123,
'shipper_length' => 123,
'shipper_dry_weight' => 123,
'units_per_shipper' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update"
payload := strings.NewReader("[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"variants": [
{
"id": "<string>",
"shipping": {
"handling_charge": 1
},
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": true,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
}
}Catalog
Update variants in bulk
Update shipping and packaging details of multiple variants.
POST
/
catalog
/
products
/
{id}
/
variants
/
bulk-update
Update variants in bulk
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"id": "<string>",
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": true,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update"
payload = [
{
"id": "<string>",
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": True,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
id: '<string>',
packaging: {
pack_width: 123,
pack_height: 123,
pack_length: 123,
pack_dry_weight: 123,
units_per_pack: 123,
vertical_rotation: true,
shipper_width: 123,
shipper_height: 123,
shipper_length: 123,
shipper_dry_weight: 123,
units_per_shipper: 123
}
}
])
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => '<string>',
'packaging' => [
'pack_width' => 123,
'pack_height' => 123,
'pack_length' => 123,
'pack_dry_weight' => 123,
'units_per_pack' => 123,
'vertical_rotation' => true,
'shipper_width' => 123,
'shipper_height' => 123,
'shipper_length' => 123,
'shipper_dry_weight' => 123,
'units_per_shipper' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update"
payload := strings.NewReader("[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/catalog/products/{id}/variants/bulk-update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"<string>\",\n \"packaging\": {\n \"pack_width\": 123,\n \"pack_height\": 123,\n \"pack_length\": 123,\n \"pack_dry_weight\": 123,\n \"units_per_pack\": 123,\n \"vertical_rotation\": true,\n \"shipper_width\": 123,\n \"shipper_height\": 123,\n \"shipper_length\": 123,\n \"shipper_dry_weight\": 123,\n \"units_per_shipper\": 123\n }\n }\n]"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"variants": [
{
"id": "<string>",
"shipping": {
"handling_charge": 1
},
"packaging": {
"pack_width": 123,
"pack_height": 123,
"pack_length": 123,
"pack_dry_weight": 123,
"units_per_pack": 123,
"vertical_rotation": true,
"shipper_width": 123,
"shipper_height": 123,
"shipper_length": 123,
"shipper_dry_weight": 123,
"units_per_shipper": 123
}
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
product id
Body
application/json
Was this page helpful?
⌘I