Create product
curl --request POST \
--url https://apix.us.amity.co/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "prod-12345",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit"
}
'import requests
url = "https://apix.us.amity.co/api/v1/products"
payload = {
"productId": "prod-12345",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit"
}
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({
productId: 'prod-12345',
productName: 'Premium Headphones',
productUrl: 'https://example.com/products/premium-headphones',
status: 'active',
price: 99.99,
currency: 'USD',
thumbnailUrl: 'https://example.com/images/headphones-thumb.jpg',
thumbnailMode: 'fit'
})
};
fetch('https://apix.us.amity.co/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://apix.us.amity.co/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([
'productId' => 'prod-12345',
'productName' => 'Premium Headphones',
'productUrl' => 'https://example.com/products/premium-headphones',
'status' => 'active',
'price' => 99.99,
'currency' => 'USD',
'thumbnailUrl' => 'https://example.com/images/headphones-thumb.jpg',
'thumbnailMode' => 'fit'
]),
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://apix.us.amity.co/api/v1/products"
payload := strings.NewReader("{\n \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\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://apix.us.amity.co/api/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/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 \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"_id": "64a1b2c3d4e5f6g7h8i9j0k1",
"productId": "prod-12345",
"networkId": "network-abc123",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit",
"importSource": "manual",
"createdBy": "user-xyz789",
"updatedBy": "user-xyz789",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"isDeleted": false
}
}{
"status": "error",
"code": 400000,
"message": "Bad Request."
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Product
Create product
Create a new product in the product catalogue.
Access Control:
- Requires admin permissions with ManageProducts flag
Important Notes:
- Product ID must be unique within the network
- Product URL must be a valid URL
- Price must be positive if provided
- Currency must be a valid ISO 4217 currency code (3 characters)
POST
/
api
/
v1
/
products
Create product
curl --request POST \
--url https://apix.us.amity.co/api/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "prod-12345",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit"
}
'import requests
url = "https://apix.us.amity.co/api/v1/products"
payload = {
"productId": "prod-12345",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit"
}
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({
productId: 'prod-12345',
productName: 'Premium Headphones',
productUrl: 'https://example.com/products/premium-headphones',
status: 'active',
price: 99.99,
currency: 'USD',
thumbnailUrl: 'https://example.com/images/headphones-thumb.jpg',
thumbnailMode: 'fit'
})
};
fetch('https://apix.us.amity.co/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://apix.us.amity.co/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([
'productId' => 'prod-12345',
'productName' => 'Premium Headphones',
'productUrl' => 'https://example.com/products/premium-headphones',
'status' => 'active',
'price' => 99.99,
'currency' => 'USD',
'thumbnailUrl' => 'https://example.com/images/headphones-thumb.jpg',
'thumbnailMode' => 'fit'
]),
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://apix.us.amity.co/api/v1/products"
payload := strings.NewReader("{\n \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\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://apix.us.amity.co/api/v1/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/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 \"productId\": \"prod-12345\",\n \"productName\": \"Premium Headphones\",\n \"productUrl\": \"https://example.com/products/premium-headphones\",\n \"status\": \"active\",\n \"price\": 99.99,\n \"currency\": \"USD\",\n \"thumbnailUrl\": \"https://example.com/images/headphones-thumb.jpg\",\n \"thumbnailMode\": \"fit\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"_id": "64a1b2c3d4e5f6g7h8i9j0k1",
"productId": "prod-12345",
"networkId": "network-abc123",
"productName": "Premium Headphones",
"productUrl": "https://example.com/products/premium-headphones",
"status": "active",
"price": 99.99,
"currency": "USD",
"thumbnailUrl": "https://example.com/images/headphones-thumb.jpg",
"thumbnailMode": "fit",
"importSource": "manual",
"createdBy": "user-xyz789",
"updatedBy": "user-xyz789",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"isDeleted": false
}
}{
"status": "error",
"code": 400000,
"message": "Bad Request."
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Unique identifier for the product
Required string length:
1 - 100Example:
"prod-12345"
Name of the product
Required string length:
1 - 200Example:
"Premium Headphones"
URL to the product page
Example:
"https://example.com/products/premium-headphones"
Product status
Available options:
active, archived Example:
"active"
Product price (must be positive)
Required range:
x > 0Example:
99.99
ISO 4217 currency code (3 characters)
Required string length:
3Example:
"USD"
URL to the product thumbnail image
Example:
"https://example.com/images/headphones-thumb.jpg"
How the thumbnail should be displayed
Available options:
fit, fill Example:
"fit"
⌘I