Products are the core resources in Lightyshare that represent items available for rental. Each product can be a single item or a bundle of multiple items.

Product Types

Individual Products (productType: 0)

Single items that can be rented individually, such as cameras, lenses, or lighting equipment.

Bundles (productType: 1)

Collections of multiple products that are rented together as a package.

Stock Management

Unit Stock (stock_type: 0)

Products with individual unit tracking. Each unit has a unique SKU and can be tracked separately. Required fields:
  • sku: Unique identifier for the product unit
  • quantity: Number of units available

Without Unit Management (stock_type: 1)

Products without individual unit tracking. Only the total quantity is managed.

Creating a Product

Basic Product Creation

curl -X POST https://lightyshare.com/api/token-secured/product \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product": {
      "title": "4K Pro Camera",
      "description": "Professional camera with full frame sensor",
      "rent": 250.0,
      "cost": 3500.0,
      "productType": 0,
      "stock_type": 0,
      "sku": "CAM-4K-001",
      "quantity": 2,
      "online": true
    }
  }'

Product with Equipment

curl -X POST https://lightyshare.com/api/token-secured/product \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product": {
      "title": "Complete Camera Kit",
      "description": "Professional camera with accessories",
      "rent": 300.0,
      "cost": 4500.0,
      "productType": 0,
      "stock_type": 0,
      "sku": "KIT-CAM-001",
      "quantity": 1,
      "equipments": [
        {
          "name": "Battery",
          "quantity": 4
        },
        {
          "name": "Memory Card",
          "quantity": 2
        },
        {
          "name": "Lens Cap",
          "quantity": 1
        }
      ],
      "images": [
        {
          "src": "https://cdn.example.com/camera-front.jpg"
        },
        {
          "src": "https://cdn.example.com/camera-back.jpg"
        }
      ],
      "online": true
    }
  }'

Updating a Product

Partial Update

curl -X PUT https://lightyshare.com/api/token-secured/product/12345 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product": {
      "rent": 275.0,
      "quantity": 3,
      "online": false
    }
  }'

Product Fields

Required Fields

FieldTypeDescriptionExample
titlestringProduct title (max 255 chars)“4K Pro Camera”
rentfloatRental price (min 0.01)250.0

Optional Fields

FieldTypeDescriptionExample
descriptionstringProduct description (Markdown/HTML)“Professional camera…”
costfloatProduct cost (min 0)3500.0
productTypeinteger0=product, 1=bundle0
stock_typeinteger0=unit stock, 1=no unit management0
skustringRequired if stock_type=0”CAM-4K-001”
quantityintegerNumber of units (min 1)2
equipmentsarrayList of included equipmentSee example above
imagesarrayProduct images (max 5)See example above
onlinebooleanAvailable for rentaltrue
archivedbooleanArchived productfalse

Equipment Items

Each equipment item requires:
{
  "name": "Equipment name",
  "quantity": 1
}

Image Requirements

Each image requires:
{
  "src": "https://cdn.example.com/image.jpg"
}
  • Maximum 5 images per product
  • Images must be accessible URLs
  • Recommended format: WEBP, JPG, PNG
  • Recommended size: 1200x800 pixels

Response Examples

Successful Creation

{
  "success": true,
  "id": 14567,
  "location": "/api/token-secured/product/14567"
}

Successful Update

{
  "success": true
}

Error Handling

Validation Errors

{
  "success": false,
  "errors": [
    {
      "field": "sku",
      "code": "REQUIRED",
      "message": "SKU is required for unit stock"
    }
  ]
}

Common Error Codes

  • REQUIRED: Missing required field
  • INVALID_FORMAT: Invalid data format
  • MIN_VALUE: Value below minimum
  • MAX_LENGTH: String exceeds maximum length