Update a product
curl --request PUT \
--url https://lightyshare.com/api/token-secured/product/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"title": "<string>",
"description": "<string>",
"rent": 1.01,
"cost": 1,
"sku": "<string>",
"quantity": 2,
"equipments": [
{
"name": "<string>",
"quantity": 2
}
],
"images": [
{
"src": "<string>"
}
],
"online": true,
"archived": true
}
}
'import requests
url = "https://lightyshare.com/api/token-secured/product/{id}"
payload = { "product": {
"title": "<string>",
"description": "<string>",
"rent": 1.01,
"cost": 1,
"sku": "<string>",
"quantity": 2,
"equipments": [
{
"name": "<string>",
"quantity": 2
}
],
"images": [{ "src": "<string>" }],
"online": True,
"archived": True
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product: {
title: '<string>',
description: '<string>',
rent: 1.01,
cost: 1,
sku: '<string>',
quantity: 2,
equipments: [{name: '<string>', quantity: 2}],
images: [{src: '<string>'}],
online: true,
archived: true
}
})
};
fetch('https://lightyshare.com/api/token-secured/product/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'product' => [
'title' => '<string>',
'description' => '<string>',
'rent' => 1.01,
'cost' => 1,
'sku' => '<string>',
'quantity' => 2,
'equipments' => [
[
'name' => '<string>',
'quantity' => 2
]
],
'images' => [
[
'src' => '<string>'
]
],
'online' => true,
'archived' => true
]
]),
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/{id}"
payload := strings.NewReader("{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://lightyshare.com/api/token-secured/product/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lightyshare.com/api/token-secured/product/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"errors": [
{
"field": "sku",
"code": "REQUIRED",
"message": "SKU is required for unit stock"
}
]
}{
"error": "Invalid or missing token"
}{
"error": "Access denied to this resource"
}{
"error": "Resource not found"
}Products
Update a product
Updates a product belonging to the authenticated user
PUT
/
product
/
{id}
Update a product
curl --request PUT \
--url https://lightyshare.com/api/token-secured/product/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"title": "<string>",
"description": "<string>",
"rent": 1.01,
"cost": 1,
"sku": "<string>",
"quantity": 2,
"equipments": [
{
"name": "<string>",
"quantity": 2
}
],
"images": [
{
"src": "<string>"
}
],
"online": true,
"archived": true
}
}
'import requests
url = "https://lightyshare.com/api/token-secured/product/{id}"
payload = { "product": {
"title": "<string>",
"description": "<string>",
"rent": 1.01,
"cost": 1,
"sku": "<string>",
"quantity": 2,
"equipments": [
{
"name": "<string>",
"quantity": 2
}
],
"images": [{ "src": "<string>" }],
"online": True,
"archived": True
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product: {
title: '<string>',
description: '<string>',
rent: 1.01,
cost: 1,
sku: '<string>',
quantity: 2,
equipments: [{name: '<string>', quantity: 2}],
images: [{src: '<string>'}],
online: true,
archived: true
}
})
};
fetch('https://lightyshare.com/api/token-secured/product/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'product' => [
'title' => '<string>',
'description' => '<string>',
'rent' => 1.01,
'cost' => 1,
'sku' => '<string>',
'quantity' => 2,
'equipments' => [
[
'name' => '<string>',
'quantity' => 2
]
],
'images' => [
[
'src' => '<string>'
]
],
'online' => true,
'archived' => true
]
]),
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/{id}"
payload := strings.NewReader("{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://lightyshare.com/api/token-secured/product/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lightyshare.com/api/token-secured/product/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product\": {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"rent\": 1.01,\n \"cost\": 1,\n \"sku\": \"<string>\",\n \"quantity\": 2,\n \"equipments\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 2\n }\n ],\n \"images\": [\n {\n \"src\": \"<string>\"\n }\n ],\n \"online\": true,\n \"archived\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"errors": [
{
"field": "sku",
"code": "REQUIRED",
"message": "SKU is required for unit stock"
}
]
}{
"error": "Invalid or missing token"
}{
"error": "Access denied to this resource"
}{
"error": "Resource not found"
}Request Structure
{
"data": {
"type": "products",
"attributes": {
"description": "Widget A - Large Size",
"barcode": "5012345678902",
"shelf_life_min": 60,
"shelf_life_max": 730
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
code | No | Updated product SKU |
description | No | Updated description |
barcode | No | Updated barcode |
shelf_life_min/max | No | Updated 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.
Path Parameters
Resource identifier
Example:
12345
Query Parameters
User authentication token
Example:
"YOUR_TOKEN"
Body
application/json
Show child attributes
Show child attributes
Response
Product successfully updated
Example:
true
⌘I