Create a New Product
curl --request POST \
--url https://api.trata.ai/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": true,
"defaultPrice": 123,
"description": "High-quality gardening tools",
"name": "Garden Tool Set",
"shippable": false,
"features": [
"<string>"
],
"scheduleAppointment": false,
"props": "stainless steel",
"tags": "gardening",
"agentIds": [
"<string>"
]
}
'import requests
url = "https://api.trata.ai/v1/products"
payload = {
"active": True,
"defaultPrice": 123,
"description": "High-quality gardening tools",
"name": "Garden Tool Set",
"shippable": False,
"features": ["<string>"],
"scheduleAppointment": False,
"props": "stainless steel",
"tags": "gardening",
"agentIds": ["<string>"]
}
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({
active: true,
defaultPrice: 123,
description: 'High-quality gardening tools',
name: 'Garden Tool Set',
shippable: false,
features: ['<string>'],
scheduleAppointment: false,
props: 'stainless steel',
tags: 'gardening',
agentIds: ['<string>']
})
};
fetch('https://api.trata.ai/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://api.trata.ai/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([
'active' => true,
'defaultPrice' => 123,
'description' => 'High-quality gardening tools',
'name' => 'Garden Tool Set',
'shippable' => false,
'features' => [
'<string>'
],
'scheduleAppointment' => false,
'props' => 'stainless steel',
'tags' => 'gardening',
'agentIds' => [
'<string>'
]
]),
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.trata.ai/v1/products"
payload := strings.NewReader("{\n \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\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.trata.ai/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trata.ai/v1/products")
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 \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "pro.1731301754.OZSMSU1S",
"orgId": "org.1726902940.GZChqlpU",
"active": true,
"defaultPrice": 1299,
"currency": "USD",
"description": "Spicy Korean Chicken Wings",
"name": "Spicy Korean Chicken Wings",
"shippable": true,
"features": [],
"scheduleAppointment": false,
"props": {},
"status": "active",
"createdBy": "trata-system",
"createdAt": "2024-11-11T05:09:14.979287",
"updatedBy": "trata-system",
"updatedAt": "2024-11-11T05:09:14.979289"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Products
Create a New Product
Create a New Product
POST
/
v1
/
products
Create a New Product
curl --request POST \
--url https://api.trata.ai/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": true,
"defaultPrice": 123,
"description": "High-quality gardening tools",
"name": "Garden Tool Set",
"shippable": false,
"features": [
"<string>"
],
"scheduleAppointment": false,
"props": "stainless steel",
"tags": "gardening",
"agentIds": [
"<string>"
]
}
'import requests
url = "https://api.trata.ai/v1/products"
payload = {
"active": True,
"defaultPrice": 123,
"description": "High-quality gardening tools",
"name": "Garden Tool Set",
"shippable": False,
"features": ["<string>"],
"scheduleAppointment": False,
"props": "stainless steel",
"tags": "gardening",
"agentIds": ["<string>"]
}
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({
active: true,
defaultPrice: 123,
description: 'High-quality gardening tools',
name: 'Garden Tool Set',
shippable: false,
features: ['<string>'],
scheduleAppointment: false,
props: 'stainless steel',
tags: 'gardening',
agentIds: ['<string>']
})
};
fetch('https://api.trata.ai/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://api.trata.ai/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([
'active' => true,
'defaultPrice' => 123,
'description' => 'High-quality gardening tools',
'name' => 'Garden Tool Set',
'shippable' => false,
'features' => [
'<string>'
],
'scheduleAppointment' => false,
'props' => 'stainless steel',
'tags' => 'gardening',
'agentIds' => [
'<string>'
]
]),
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.trata.ai/v1/products"
payload := strings.NewReader("{\n \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\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.trata.ai/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trata.ai/v1/products")
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 \"active\": true,\n \"defaultPrice\": 123,\n \"description\": \"High-quality gardening tools\",\n \"name\": \"Garden Tool Set\",\n \"shippable\": false,\n \"features\": [\n \"<string>\"\n ],\n \"scheduleAppointment\": false,\n \"props\": \"stainless steel\",\n \"tags\": \"gardening\",\n \"agentIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "pro.1731301754.OZSMSU1S",
"orgId": "org.1726902940.GZChqlpU",
"active": true,
"defaultPrice": 1299,
"currency": "USD",
"description": "Spicy Korean Chicken Wings",
"name": "Spicy Korean Chicken Wings",
"shippable": true,
"features": [],
"scheduleAppointment": false,
"props": {},
"status": "active",
"createdBy": "trata-system",
"createdAt": "2024-11-11T05:09:14.979287",
"updatedBy": "trata-system",
"updatedAt": "2024-11-11T05:09:14.979289"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
application/json
Currency of the product
Available options:
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, XSU, XUA, YER, ZAR, ZMW, ZWL Required string length:
3Response
Product created successfully
Product and services offered by the business
