curl --request POST \
--url https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"units": [
{
"name": "<string>",
"code": "<string>",
"conversion_factor": 123
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units"
payload = { "units": [
{
"name": "<string>",
"code": "<string>",
"conversion_factor": 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({units: [{name: '<string>', code: '<string>', conversion_factor: 123}]})
};
fetch('https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/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/uom-categories/{uom_category}/units",
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([
'units' => [
[
'name' => '<string>',
'code' => '<string>',
'conversion_factor' => 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.exowpee.com/v1/catalog/uom-categories/{uom_category}/units"
payload := strings.NewReader("{\n \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 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://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units")
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 \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"category_id": "<string>",
"name": "<string>",
"code": "<string>",
"conversion_factor": 123,
"is_reference": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]{
"message": "<string>",
"errors": {}
}Add units to a category
Adds one or more units of measure to a category.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"units": [
{
"name": "<string>",
"code": "<string>",
"conversion_factor": 123
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units"
payload = { "units": [
{
"name": "<string>",
"code": "<string>",
"conversion_factor": 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({units: [{name: '<string>', code: '<string>', conversion_factor: 123}]})
};
fetch('https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/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/uom-categories/{uom_category}/units",
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([
'units' => [
[
'name' => '<string>',
'code' => '<string>',
'conversion_factor' => 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.exowpee.com/v1/catalog/uom-categories/{uom_category}/units"
payload := strings.NewReader("{\n \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 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://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/uom-categories/{uom_category}/units")
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 \"units\": [\n {\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"conversion_factor\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"category_id": "<string>",
"name": "<string>",
"code": "<string>",
"conversion_factor": 123,
"is_reference": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]{
"message": "<string>",
"errors": {}
}uom_units.create
Conditions
- The category cannot be the reserved bundle category (exowpee_bundle_count).
- Unit names are lowercased and must not already exist in the category.
- Codes are at most 10 characters, distinct inside the payload (case-insensitive) and not already used by any unit of the organization.
- Conversion factors are integers greater than 1: a new unit can never be the reference unit.
- Inserts the units as custom (not built-in, not reference) units of the category.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the category that receives the units (27-character KSUID).
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, category_id, name, code, conversion_factor, is_reference, 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: .
Body
Units to add to the category. Required, at least one.
1Show child attributes
Show child attributes
Response
Resource (only with response=resource).
Identifier of the unit (27-character KSUID).
Identifier of the category that owns the unit (27-character KSUID).
Lowercase name of the unit, unique within its category.
Short symbol of the unit, unique among the organization's units ignoring case.
Whole number of reference units in one of this unit; 1 for the reference unit.
True when this unit is the base unit of its category.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).