Create a product.
curl --request POST \
--url https://dash.dmly.io/api/v1/products \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Sulfate-free Shampoo 250ml",
"category_id": "9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f",
"description": "Gentle daily shampoo.",
"sku": "SKU-001",
"price": 12,
"cost_price": 5,
"currency": "USD",
"tax_rate": 7.5,
"tax_inclusive": false,
"track_stock": true,
"stock_quantity": 40,
"low_stock_threshold": 5,
"image_url": "https://cdn.example.com/shampoo.jpg",
"meta_sync_facebook": false,
"meta_sync_instagram": false,
"sort_order": 0,
"active": true
}
'import requests
url = "https://dash.dmly.io/api/v1/products"
payload = {
"name": "Sulfate-free Shampoo 250ml",
"category_id": "9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f",
"description": "Gentle daily shampoo.",
"sku": "SKU-001",
"price": 12,
"cost_price": 5,
"currency": "USD",
"tax_rate": 7.5,
"tax_inclusive": False,
"track_stock": True,
"stock_quantity": 40,
"low_stock_threshold": 5,
"image_url": "https://cdn.example.com/shampoo.jpg",
"meta_sync_facebook": False,
"meta_sync_instagram": False,
"sort_order": 0,
"active": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sulfate-free Shampoo 250ml',
category_id: '9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f',
description: 'Gentle daily shampoo.',
sku: 'SKU-001',
price: 12,
cost_price: 5,
currency: 'USD',
tax_rate: 7.5,
tax_inclusive: false,
track_stock: true,
stock_quantity: 40,
low_stock_threshold: 5,
image_url: 'https://cdn.example.com/shampoo.jpg',
meta_sync_facebook: false,
meta_sync_instagram: false,
sort_order: 0,
active: true
})
};
fetch('https://dash.dmly.io/api/v1/products', 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://dash.dmly.io/api/v1/products",
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([
'name' => 'Sulfate-free Shampoo 250ml',
'category_id' => '9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f',
'description' => 'Gentle daily shampoo.',
'sku' => 'SKU-001',
'price' => 12,
'cost_price' => 5,
'currency' => 'USD',
'tax_rate' => 7.5,
'tax_inclusive' => false,
'track_stock' => true,
'stock_quantity' => 40,
'low_stock_threshold' => 5,
'image_url' => 'https://cdn.example.com/shampoo.jpg',
'meta_sync_facebook' => false,
'meta_sync_instagram' => false,
'sort_order' => 0,
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://dash.dmly.io/api/v1/products"
payload := strings.NewReader("{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://dash.dmly.io/api/v1/products")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Creates a product via the OfferingService write seam (records the stock ledger opening balance when tracking stock and fires the ProductCreated event). category_id, when supplied, is a ServiceCategory uuid. Returns 201 with the created product.
POST
/
products
Create a product.
curl --request POST \
--url https://dash.dmly.io/api/v1/products \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Sulfate-free Shampoo 250ml",
"category_id": "9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f",
"description": "Gentle daily shampoo.",
"sku": "SKU-001",
"price": 12,
"cost_price": 5,
"currency": "USD",
"tax_rate": 7.5,
"tax_inclusive": false,
"track_stock": true,
"stock_quantity": 40,
"low_stock_threshold": 5,
"image_url": "https://cdn.example.com/shampoo.jpg",
"meta_sync_facebook": false,
"meta_sync_instagram": false,
"sort_order": 0,
"active": true
}
'import requests
url = "https://dash.dmly.io/api/v1/products"
payload = {
"name": "Sulfate-free Shampoo 250ml",
"category_id": "9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f",
"description": "Gentle daily shampoo.",
"sku": "SKU-001",
"price": 12,
"cost_price": 5,
"currency": "USD",
"tax_rate": 7.5,
"tax_inclusive": False,
"track_stock": True,
"stock_quantity": 40,
"low_stock_threshold": 5,
"image_url": "https://cdn.example.com/shampoo.jpg",
"meta_sync_facebook": False,
"meta_sync_instagram": False,
"sort_order": 0,
"active": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sulfate-free Shampoo 250ml',
category_id: '9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f',
description: 'Gentle daily shampoo.',
sku: 'SKU-001',
price: 12,
cost_price: 5,
currency: 'USD',
tax_rate: 7.5,
tax_inclusive: false,
track_stock: true,
stock_quantity: 40,
low_stock_threshold: 5,
image_url: 'https://cdn.example.com/shampoo.jpg',
meta_sync_facebook: false,
meta_sync_instagram: false,
sort_order: 0,
active: true
})
};
fetch('https://dash.dmly.io/api/v1/products', 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://dash.dmly.io/api/v1/products",
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([
'name' => 'Sulfate-free Shampoo 250ml',
'category_id' => '9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f',
'description' => 'Gentle daily shampoo.',
'sku' => 'SKU-001',
'price' => 12,
'cost_price' => 5,
'currency' => 'USD',
'tax_rate' => 7.5,
'tax_inclusive' => false,
'track_stock' => true,
'stock_quantity' => 40,
'low_stock_threshold' => 5,
'image_url' => 'https://cdn.example.com/shampoo.jpg',
'meta_sync_facebook' => false,
'meta_sync_instagram' => false,
'sort_order' => 0,
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://dash.dmly.io/api/v1/products"
payload := strings.NewReader("{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://dash.dmly.io/api/v1/products")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sulfate-free Shampoo 250ml\",\n \"category_id\": \"9f1c2b6e-4d3a-4c2b-8e1a-2f3b4c5d6e7f\",\n \"description\": \"Gentle daily shampoo.\",\n \"sku\": \"SKU-001\",\n \"price\": 12,\n \"cost_price\": 5,\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"tax_inclusive\": false,\n \"track_stock\": true,\n \"stock_quantity\": 40,\n \"low_stock_threshold\": 5,\n \"image_url\": \"https://cdn.example.com/shampoo.jpg\",\n \"meta_sync_facebook\": false,\n \"meta_sync_instagram\": false,\n \"sort_order\": 0,\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
apiKeyAuthbearerAuth
Your workspace API key. It both authenticates the caller and selects the workspace.
Body
application/json
Response
Success.
Was this page helpful?
⌘I

