Replace a record's variants
curl --request PUT \
--url https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant_options": [
{
"name": "<string>",
"values": [
"<string>"
]
}
],
"variants": [
{
"option_values": [
"<string>"
],
"id": "<string>",
"price": 123,
"sku": "<string>",
"images": [
{}
],
"stock": 123
}
]
}
'import requests
url = "https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants"
payload = {
"variant_options": [
{
"name": "<string>",
"values": ["<string>"]
}
],
"variants": [
{
"option_values": ["<string>"],
"id": "<string>",
"price": 123,
"sku": "<string>",
"images": [{}],
"stock": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variant_options: [{name: '<string>', values: ['<string>']}],
variants: [
{
option_values: ['<string>'],
id: '<string>',
price: 123,
sku: '<string>',
images: [{}],
stock: 123
}
]
})
};
fetch('https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants', 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://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'variant_options' => [
[
'name' => '<string>',
'values' => [
'<string>'
]
]
],
'variants' => [
[
'option_values' => [
'<string>'
],
'id' => '<string>',
'price' => 123,
'sku' => '<string>',
'images' => [
[
]
],
'stock' => 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://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants"
payload := strings.NewReader("{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"variant_options": [
{
"name": "<string>",
"values": [
"<string>"
]
}
],
"currency": "<string>",
"variants": [
{
"id": "<string>",
"option_values": [
"<string>"
],
"title": "<string>",
"price": "<string>",
"sku": "<string>",
"stock": "<string>",
"images": [
{}
],
"position": 123
}
]
}{
"detail": {
"code": "<string>",
"reason": "<string>",
"detail": {},
"current": "<string>"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": {
"code": "<string>",
"reason": "<string>",
"detail": {},
"current": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}Catalogs
Replace a record's variants
The whole set: options with their values, and every variant. Variants left out are deleted. A variant’s stock sets its stock, and null stops tracking it. Left out, the stock stays as it is for a variant that keeps its id or its option values. Sending the stock a variant already has records no stock movement. A negative stock is refused with 400 stock_below_zero, and then nothing in the request is saved. Stock takes at most two decimals. A change of stock alone sends no webhook.
PUT
/
v1
/
catalogs
/
{catalog_id}
/
records
/
{record_id}
/
variants
Replace a record's variants
curl --request PUT \
--url https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant_options": [
{
"name": "<string>",
"values": [
"<string>"
]
}
],
"variants": [
{
"option_values": [
"<string>"
],
"id": "<string>",
"price": 123,
"sku": "<string>",
"images": [
{}
],
"stock": 123
}
]
}
'import requests
url = "https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants"
payload = {
"variant_options": [
{
"name": "<string>",
"values": ["<string>"]
}
],
"variants": [
{
"option_values": ["<string>"],
"id": "<string>",
"price": 123,
"sku": "<string>",
"images": [{}],
"stock": 123
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
variant_options: [{name: '<string>', values: ['<string>']}],
variants: [
{
option_values: ['<string>'],
id: '<string>',
price: 123,
sku: '<string>',
images: [{}],
stock: 123
}
]
})
};
fetch('https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants', 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://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'variant_options' => [
[
'name' => '<string>',
'values' => [
'<string>'
]
]
],
'variants' => [
[
'option_values' => [
'<string>'
],
'id' => '<string>',
'price' => 123,
'sku' => '<string>',
'images' => [
[
]
],
'stock' => 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://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants"
payload := strings.NewReader("{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ciarem.ai/v1/catalogs/{catalog_id}/records/{record_id}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"variant_options\": [\n {\n \"name\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"variants\": [\n {\n \"option_values\": [\n \"<string>\"\n ],\n \"id\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"images\": [\n {}\n ],\n \"stock\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"variant_options": [
{
"name": "<string>",
"values": [
"<string>"
]
}
],
"currency": "<string>",
"variants": [
{
"id": "<string>",
"option_values": [
"<string>"
],
"title": "<string>",
"price": "<string>",
"sku": "<string>",
"stock": "<string>",
"images": [
{}
],
"position": 123
}
]
}{
"detail": {
"code": "<string>",
"reason": "<string>",
"detail": {},
"current": "<string>"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": {
"code": "<string>",
"reason": "<string>",
"detail": {},
"current": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}Body
application/json