Create Variant
curl --request POST \
--url https://api.example.com/api/dashboard/products/{product_id}/variants \
--header 'Content-Type: application/json' \
--data '
{
"price": 1,
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"compare_at_price": 1,
"cost_per_item": 1,
"inventory_quantity": 0,
"inventory_policy": "deny",
"low_stock_threshold": 10,
"weight": 123,
"weight_unit": "kg",
"requires_shipping": true,
"image_url": "<string>",
"available": true
}
'import requests
url = "https://api.example.com/api/dashboard/products/{product_id}/variants"
payload = {
"price": 1,
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"compare_at_price": 1,
"cost_per_item": 1,
"inventory_quantity": 0,
"inventory_policy": "deny",
"low_stock_threshold": 10,
"weight": 123,
"weight_unit": "kg",
"requires_shipping": True,
"image_url": "<string>",
"available": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
price: 1,
sku: '<string>',
barcode: '<string>',
option1: '<string>',
option2: '<string>',
option3: '<string>',
compare_at_price: 1,
cost_per_item: 1,
inventory_quantity: 0,
inventory_policy: 'deny',
low_stock_threshold: 10,
weight: 123,
weight_unit: 'kg',
requires_shipping: true,
image_url: '<string>',
available: true
})
};
fetch('https://api.example.com/api/dashboard/products/{product_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.example.com/api/dashboard/products/{product_id}/variants",
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([
'price' => 1,
'sku' => '<string>',
'barcode' => '<string>',
'option1' => '<string>',
'option2' => '<string>',
'option3' => '<string>',
'compare_at_price' => 1,
'cost_per_item' => 1,
'inventory_quantity' => 0,
'inventory_policy' => 'deny',
'low_stock_threshold' => 10,
'weight' => 123,
'weight_unit' => 'kg',
'requires_shipping' => true,
'image_url' => '<string>',
'available' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/dashboard/products/{product_id}/variants"
payload := strings.NewReader("{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/api/dashboard/products/{product_id}/variants")
.header("Content-Type", "application/json")
.body("{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/dashboard/products/{product_id}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"price": "<string>",
"compare_at_price": "<string>",
"cost_per_item": "<string>",
"inventory_quantity": 123,
"inventory_policy": "<string>",
"low_stock_threshold": 123,
"weight": "<string>",
"weight_unit": "<string>",
"requires_shipping": true,
"image_url": "<string>",
"available": true,
"is_low_stock": true,
"is_out_of_stock": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Dashboard
Create Variant
Create a new variant for a product.
POST
/
api
/
dashboard
/
products
/
{product_id}
/
variants
Create Variant
curl --request POST \
--url https://api.example.com/api/dashboard/products/{product_id}/variants \
--header 'Content-Type: application/json' \
--data '
{
"price": 1,
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"compare_at_price": 1,
"cost_per_item": 1,
"inventory_quantity": 0,
"inventory_policy": "deny",
"low_stock_threshold": 10,
"weight": 123,
"weight_unit": "kg",
"requires_shipping": true,
"image_url": "<string>",
"available": true
}
'import requests
url = "https://api.example.com/api/dashboard/products/{product_id}/variants"
payload = {
"price": 1,
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"compare_at_price": 1,
"cost_per_item": 1,
"inventory_quantity": 0,
"inventory_policy": "deny",
"low_stock_threshold": 10,
"weight": 123,
"weight_unit": "kg",
"requires_shipping": True,
"image_url": "<string>",
"available": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
price: 1,
sku: '<string>',
barcode: '<string>',
option1: '<string>',
option2: '<string>',
option3: '<string>',
compare_at_price: 1,
cost_per_item: 1,
inventory_quantity: 0,
inventory_policy: 'deny',
low_stock_threshold: 10,
weight: 123,
weight_unit: 'kg',
requires_shipping: true,
image_url: '<string>',
available: true
})
};
fetch('https://api.example.com/api/dashboard/products/{product_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.example.com/api/dashboard/products/{product_id}/variants",
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([
'price' => 1,
'sku' => '<string>',
'barcode' => '<string>',
'option1' => '<string>',
'option2' => '<string>',
'option3' => '<string>',
'compare_at_price' => 1,
'cost_per_item' => 1,
'inventory_quantity' => 0,
'inventory_policy' => 'deny',
'low_stock_threshold' => 10,
'weight' => 123,
'weight_unit' => 'kg',
'requires_shipping' => true,
'image_url' => '<string>',
'available' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/dashboard/products/{product_id}/variants"
payload := strings.NewReader("{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/api/dashboard/products/{product_id}/variants")
.header("Content-Type", "application/json")
.body("{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/dashboard/products/{product_id}/variants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"price\": 1,\n \"sku\": \"<string>\",\n \"barcode\": \"<string>\",\n \"option1\": \"<string>\",\n \"option2\": \"<string>\",\n \"option3\": \"<string>\",\n \"compare_at_price\": 1,\n \"cost_per_item\": 1,\n \"inventory_quantity\": 0,\n \"inventory_policy\": \"deny\",\n \"low_stock_threshold\": 10,\n \"weight\": 123,\n \"weight_unit\": \"kg\",\n \"requires_shipping\": true,\n \"image_url\": \"<string>\",\n \"available\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sku": "<string>",
"barcode": "<string>",
"option1": "<string>",
"option2": "<string>",
"option3": "<string>",
"price": "<string>",
"compare_at_price": "<string>",
"cost_per_item": "<string>",
"inventory_quantity": 123,
"inventory_policy": "<string>",
"low_stock_threshold": 123,
"weight": "<string>",
"weight_unit": "<string>",
"requires_shipping": true,
"image_url": "<string>",
"available": true,
"is_low_stock": true,
"is_out_of_stock": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Body
application/json
Schema for creating a variant.
Required range:
x >= 0Maximum string length:
100Maximum string length:
100Maximum string length:
100Maximum string length:
100Maximum string length:
100Required range:
x >= 0Required range:
x >= 0Required range:
x >= 0Pattern:
^(deny|continue)$Required range:
x >= 0Pattern:
^(kg|g|lb|oz)$Response
Successful Response
Schema for variant in responses.
Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$