Create a product
curl --request POST \
--url https://lightyshare.com/api/token-secured/product \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"title": "4K Pro Camera",
"rent": 250,
"description": "Professional camera with full frame sensor",
"cost": 3500,
"productType": 0,
"stock_type": 0,
"sku": "CAM-4K-001",
"quantity": 2,
"equipments": [
{
"name": "Battery",
"quantity": 4
}
],
"images": [
{
"src": "https://cdn.example.com/camera-front.jpg"
}
],
"online": true,
"archived": false
}
}
'import requests
url = "https://lightyshare.com/api/token-secured/product"
payload = { "product": {
"title": "4K Pro Camera",
"rent": 250,
"description": "Professional camera with full frame sensor",
"cost": 3500,
"productType": 0,
"stock_type": 0,
"sku": "CAM-4K-001",
"quantity": 2,
"equipments": [
{
"name": "Battery",
"quantity": 4
}
],
"images": [{ "src": "https://cdn.example.com/camera-front.jpg" }],
"online": True,
"archived": False
} }
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({
product: {
title: '4K Pro Camera',
rent: 250,
description: 'Professional camera with full frame sensor',
cost: 3500,
productType: 0,
stock_type: 0,
sku: 'CAM-4K-001',
quantity: 2,
equipments: [{name: 'Battery', quantity: 4}],
images: [{src: 'https://cdn.example.com/camera-front.jpg'}],
online: true,
archived: false
}
})
};
fetch('https://lightyshare.com/api/token-secured/product', 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://lightyshare.com/api/token-secured/product",
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([
'product' => [
'title' => '4K Pro Camera',
'rent' => 250,
'description' => 'Professional camera with full frame sensor',
'cost' => 3500,
'productType' => 0,
'stock_type' => 0,
'sku' => 'CAM-4K-001',
'quantity' => 2,
'equipments' => [
[
'name' => 'Battery',
'quantity' => 4
]
],
'images' => [
[
'src' => 'https://cdn.example.com/camera-front.jpg'
]
],
'online' => true,
'archived' => false
]
]),
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://lightyshare.com/api/token-secured/product"
payload := strings.NewReader("{\n \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\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://lightyshare.com/api/token-secured/product")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lightyshare.com/api/token-secured/product")
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 \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": 14567,
"location": "/api/token-secured/product/14567"
}{
"success": false,
"errors": [
{
"field": "sku",
"code": "REQUIRED",
"message": "SKU is required for unit stock"
}
]
}{
"error": "Invalid or missing token"
}{
"error": "Request limit exceeded"
}Products
Create a product
Creates a new product for the authenticated user
POST
/
product
Create a product
curl --request POST \
--url https://lightyshare.com/api/token-secured/product \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"title": "4K Pro Camera",
"rent": 250,
"description": "Professional camera with full frame sensor",
"cost": 3500,
"productType": 0,
"stock_type": 0,
"sku": "CAM-4K-001",
"quantity": 2,
"equipments": [
{
"name": "Battery",
"quantity": 4
}
],
"images": [
{
"src": "https://cdn.example.com/camera-front.jpg"
}
],
"online": true,
"archived": false
}
}
'import requests
url = "https://lightyshare.com/api/token-secured/product"
payload = { "product": {
"title": "4K Pro Camera",
"rent": 250,
"description": "Professional camera with full frame sensor",
"cost": 3500,
"productType": 0,
"stock_type": 0,
"sku": "CAM-4K-001",
"quantity": 2,
"equipments": [
{
"name": "Battery",
"quantity": 4
}
],
"images": [{ "src": "https://cdn.example.com/camera-front.jpg" }],
"online": True,
"archived": False
} }
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({
product: {
title: '4K Pro Camera',
rent: 250,
description: 'Professional camera with full frame sensor',
cost: 3500,
productType: 0,
stock_type: 0,
sku: 'CAM-4K-001',
quantity: 2,
equipments: [{name: 'Battery', quantity: 4}],
images: [{src: 'https://cdn.example.com/camera-front.jpg'}],
online: true,
archived: false
}
})
};
fetch('https://lightyshare.com/api/token-secured/product', 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://lightyshare.com/api/token-secured/product",
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([
'product' => [
'title' => '4K Pro Camera',
'rent' => 250,
'description' => 'Professional camera with full frame sensor',
'cost' => 3500,
'productType' => 0,
'stock_type' => 0,
'sku' => 'CAM-4K-001',
'quantity' => 2,
'equipments' => [
[
'name' => 'Battery',
'quantity' => 4
]
],
'images' => [
[
'src' => 'https://cdn.example.com/camera-front.jpg'
]
],
'online' => true,
'archived' => false
]
]),
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://lightyshare.com/api/token-secured/product"
payload := strings.NewReader("{\n \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\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://lightyshare.com/api/token-secured/product")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lightyshare.com/api/token-secured/product")
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 \"product\": {\n \"title\": \"4K Pro Camera\",\n \"rent\": 250,\n \"description\": \"Professional camera with full frame sensor\",\n \"cost\": 3500,\n \"productType\": 0,\n \"stock_type\": 0,\n \"sku\": \"CAM-4K-001\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"Battery\",\n \"quantity\": 4\n }\n ],\n \"images\": [\n {\n \"src\": \"https://cdn.example.com/camera-front.jpg\"\n }\n ],\n \"online\": true,\n \"archived\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"id": 14567,
"location": "/api/token-secured/product/14567"
}{
"success": false,
"errors": [
{
"field": "sku",
"code": "REQUIRED",
"message": "SKU is required for unit stock"
}
]
}{
"error": "Invalid or missing token"
}{
"error": "Request limit exceeded"
}Request Structure
{
"data": {
"type": "products",
"attributes": {
"code": "SKU-001",
"description": "Widget A - Standard Size",
"stock_unit_type_id": 1,
"barcode": "5012345678901",
"commodity_code": "84719000",
"country_of_manufacture": "GB",
"shelf_life_min": 30,
"shelf_life_max": 365
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
code | No | Unique product SKU code |
description | Yes | Short product description |
stock_unit_type_id | Yes | Unit of measure type ID |
barcode | No | Primary product barcode |
commodity_code | No | HS code for customs |
shelf_life_min | No | Minimum shelf life in days |
shelf_life_max | No | Maximum shelf life in days |
Authorizations
Use your API token in the Authorization header with Bearer scheme.
Alternative: You can also pass the token as a query parameter ?token=your_token for backward compatibility.
Query Parameters
User authentication token
Example:
"YOUR_TOKEN"
Body
application/json
Show child attributes
Show child attributes
⌘I