curl --request POST \
--url https://api.exowpee.com/v1/catalog/stockables/{stockable}/units \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/stockables/{stockable}/units"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/stockables/{stockable}/units', 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.exowpee.com/v1/catalog/stockables/{stockable}/units",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/stockables/{stockable}/units"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/stockables/{stockable}/units")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/stockables/{stockable}/units")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"stockable_id": "<string>",
"uom_unit_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"is_active": true,
"sort_order": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"uom_unit": {},
"prices": "<array>",
"stockable": {}
}
]{
"message": "<string>",
"errors": {}
}Add units to an item
Adds units of sale to an item, each with SKU, barcode and prices.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/stockables/{stockable}/units \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/stockables/{stockable}/units"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/stockables/{stockable}/units', 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.exowpee.com/v1/catalog/stockables/{stockable}/units",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/stockables/{stockable}/units"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/stockables/{stockable}/units")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/stockables/{stockable}/units")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"stockable_id": "<string>",
"uom_unit_id": "<string>",
"sku": "<string>",
"barcode": "<string>",
"is_active": true,
"sort_order": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"uom_unit": {},
"prices": "<array>",
"stockable": {}
}
]{
"message": "<string>",
"errors": {}
}variant_units.create, bundle_units.create
Conditions
- The permission depends on the type of item: variant_units.create or bundle_units.create.
- units is required with at least one entry; each entry needs a uom_unit_id and a non-empty prices list.
- Every unit of measure must belong to the organization and all units sent must be in the same measurement category, which must match the category already set on the item.
- A unit of measure can be linked to an item only once, counting both existing units and the request itself.
- A given SKU or barcode must not already be used by another unit of the organization.
- Each price follows the item price rules: name unique per unit, amount unique across the item for the company, decimal in major units, and a tax setup that can be calculated; the whole call is refused if any price fails.
- Generates a SKU of the form ITEM-UNIT-001 when none is sent, incrementing until it is free in the organization.
- Sets the item’s measurement category from the first unit when it had none.
- Creates the prices sent with each unit, for the caller’s company, with their tax settings.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the sellable item (stockable): the stockable record of a product variant or of a bundle, not the variant or bundle identifier itself.
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, stockable_id, uom_unit_id, sku, barcode, is_active, sort_order, created_at, updated_at.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: uomUnit, prices, stockable, stockable.vat_rate, stockable.taxes, stockable.subject.
Response
Resource (only with response=resource).
Identifier of the unit of sale (27-character KSUID string).
Identifier of the item the unit belongs to.
Identifier of the unit of measure (for example piece or box) this unit of sale uses.
Stock keeping unit code, unique within the organization. Generated as ITEM-UNIT-001 when not sent at creation.
Barcode of the unit, unique within the organization when set; null when none.
Whether the unit can be used for new prices and sales. A unit already used by orders is deactivated instead of deleted.
Display position of the unit; lower values come first. 0 when not sent at creation.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Unit of measure object. Only returned when selected with ?include=uomUnit.
Prices of this unit for the caller's company. Only returned when selected with ?include=prices.
The item the unit belongs to. Only returned when selected with ?include=stockable.