Distribute a quantity across a product's variants
curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"master_sku_id": 5521,
"total_quantity": 100
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute"
payload = {
"master_sku_id": 5521,
"total_quantity": 100
}
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({master_sku_id: 5521, total_quantity: 100})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute', 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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute",
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([
'master_sku_id' => 5521,
'total_quantity' => 100
]),
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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute"
payload := strings.NewReader("{\n \"master_sku_id\": 5521,\n \"total_quantity\": 100\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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"master_sku_id\": 5521,\n \"total_quantity\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute")
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 \"master_sku_id\": 5521,\n \"total_quantity\": 100\n}"
response = http.request(request)
puts response.read_body{
"data": {
"master": {
"sku_id": 5521,
"internal_sku": "TEE-CLASSIC",
"product_name": "Classic Tee",
"axes": [
"Size"
]
},
"source": "master",
"reason": null,
"reason_message": null,
"template": {
"id": 12,
"name": "Apparel sizes",
"description": null,
"axis_count": 1,
"mode": "single_axis",
"row_axis_name": null,
"column_axis_name": "Size",
"row_values": [],
"column_values": [
{
"value": "S",
"percent": 40,
"sort_order": 0
},
{
"value": "M",
"percent": 60,
"sort_order": 1
}
],
"cells": [
{
"size": "S",
"axis": "column",
"percent": 40,
"weight": 0.4
},
{
"size": "M",
"axis": "column",
"percent": 60,
"weight": 0.6
}
],
"is_default": false,
"is_active": true,
"category_id": null,
"category_name": null,
"warehouse_id": null
},
"rejected_template": null,
"grid": {
"template_id": 12,
"template_name": "Apparel sizes",
"axis_count": 1,
"row_axis_name": null,
"column_axis_name": "Size",
"row_values": [],
"column_values": [
{
"value": "S",
"percent": 40
},
{
"value": "M",
"percent": 60
}
],
"total_requested": 100,
"total_allocated": 100,
"matched_cell_count": 2,
"skipped_cell_count": 0,
"warnings": [],
"cells": [
{
"row_value": null,
"column_value": "S",
"row_index": null,
"column_index": 0,
"key": "0000:0000",
"share_percent": 40,
"match_status": "matched",
"match_note": null,
"quantity": 40,
"included": true,
"child_sku_id": 5522,
"child_internal_sku": "TEE-CLASSIC-S",
"child_product_name": "Classic Tee - S",
"unit_price": 4.25,
"unit_price_source": "child",
"inventory_tracked": true,
"is_kit": false
},
{
"row_value": null,
"column_value": "M",
"row_index": null,
"column_index": 1,
"key": "0000:0001",
"share_percent": 60,
"match_status": "matched",
"match_note": null,
"quantity": 60,
"included": true,
"child_sku_id": 5523,
"child_internal_sku": "TEE-CLASSIC-M",
"child_product_name": "Classic Tee - M",
"unit_price": 4.25,
"unit_price_source": "child",
"inventory_tracked": true,
"is_kit": false
}
]
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Distribution Templates
Distribute a quantity across a product's variants
Splits a total quantity for a master SKU across its variants using the resolved distribution
template (see GET /distribution-templates/resolve for how the template is picked). The
per-cell quantities are whole numbers that add up exactly to total_quantity. Cells with
no matching variant SKU are dropped and their share goes to the matched ones.
This is a calculation only. Nothing is created or saved; use the returned quantities to
build your own request, e.g. POST /work-orders/bulk.
POST
/
distribution-templates
/
distribute
Distribute a quantity across a product's variants
curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"master_sku_id": 5521,
"total_quantity": 100
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute"
payload = {
"master_sku_id": 5521,
"total_quantity": 100
}
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({master_sku_id: 5521, total_quantity: 100})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute', 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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute",
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([
'master_sku_id' => 5521,
'total_quantity' => 100
]),
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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute"
payload := strings.NewReader("{\n \"master_sku_id\": 5521,\n \"total_quantity\": 100\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://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"master_sku_id\": 5521,\n \"total_quantity\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/distribution-templates/distribute")
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 \"master_sku_id\": 5521,\n \"total_quantity\": 100\n}"
response = http.request(request)
puts response.read_body{
"data": {
"master": {
"sku_id": 5521,
"internal_sku": "TEE-CLASSIC",
"product_name": "Classic Tee",
"axes": [
"Size"
]
},
"source": "master",
"reason": null,
"reason_message": null,
"template": {
"id": 12,
"name": "Apparel sizes",
"description": null,
"axis_count": 1,
"mode": "single_axis",
"row_axis_name": null,
"column_axis_name": "Size",
"row_values": [],
"column_values": [
{
"value": "S",
"percent": 40,
"sort_order": 0
},
{
"value": "M",
"percent": 60,
"sort_order": 1
}
],
"cells": [
{
"size": "S",
"axis": "column",
"percent": 40,
"weight": 0.4
},
{
"size": "M",
"axis": "column",
"percent": 60,
"weight": 0.6
}
],
"is_default": false,
"is_active": true,
"category_id": null,
"category_name": null,
"warehouse_id": null
},
"rejected_template": null,
"grid": {
"template_id": 12,
"template_name": "Apparel sizes",
"axis_count": 1,
"row_axis_name": null,
"column_axis_name": "Size",
"row_values": [],
"column_values": [
{
"value": "S",
"percent": 40
},
{
"value": "M",
"percent": 60
}
],
"total_requested": 100,
"total_allocated": 100,
"matched_cell_count": 2,
"skipped_cell_count": 0,
"warnings": [],
"cells": [
{
"row_value": null,
"column_value": "S",
"row_index": null,
"column_index": 0,
"key": "0000:0000",
"share_percent": 40,
"match_status": "matched",
"match_note": null,
"quantity": 40,
"included": true,
"child_sku_id": 5522,
"child_internal_sku": "TEE-CLASSIC-S",
"child_product_name": "Classic Tee - S",
"unit_price": 4.25,
"unit_price_source": "child",
"inventory_tracked": true,
"is_kit": false
},
{
"row_value": null,
"column_value": "M",
"row_index": null,
"column_index": 1,
"key": "0000:0001",
"share_percent": 60,
"match_status": "matched",
"match_note": null,
"quantity": 60,
"included": true,
"child_sku_id": 5523,
"child_internal_sku": "TEE-CLASSIC-M",
"child_product_name": "Classic Tee - M",
"unit_price": 4.25,
"unit_price_source": "child",
"inventory_tracked": true,
"is_kit": false
}
]
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Body
application/json