Products API Documentation

Product catalog management and inventory

Products API

Complete product catalog management with inventory tracking

Overview

The Products API provides complete CRUD operations for product management including creation, retrieval, updating, and deletion of products. Support for services, activities, and pricing.

Product Data

  • Title & description
  • Service type
  • Activities list

Management

  • Create products
  • Update details
  • Delete products

Features

  • Price management
  • Image support
  • WordPress sync
Method Endpoint Description Requirements
Product Management
GET /api/products/list List all products with filtering and pagination
  • service (optional) – filter by service type (integer)
  • search (optional) – search in title and description
  • min_price (optional) – minimum price filter
  • max_price (optional) – maximum price filter
  • order_by (optional) – sort field: created_at, price, title (default: created_at)
  • order_direction (optional) – asc or desc (default: desc)
  • per_page (optional) – results per page (default: 15)
GET /api/products/{id} Get detailed product information by ID
  • id (required) – Product ID
POST /api/products/create Create a new product
  • title (required) – product title
  • description (required) – product description
  • price (required) – product price (numeric, minimum 0)
  • service (required) – service type (integer)
  • wp_id (optional) – WordPress ID for sync
  • activities (optional) – array of activity strings
  • image (optional) – product image URL or path
PUT /api/products/{id} Update existing product information (full update)
  • id (required) – Product ID
  • title (optional) – updated product title
  • description (optional) – updated description
  • price (optional) – updated price
  • service (optional) – updated service type
  • wp_id (optional) – updated WordPress ID
  • activities (optional) – updated activities array
  • image (optional) – updated image URL
PATCH /api/products/{id} Partially update product information
  • id (required) – Product ID
  • (any field) – only provided fields will be updated
DELETE /api/products/{id} Remove product from database
  • id (required) – Product ID

Request Examples

Create New Product

POST /api/products/create

{ "title": "Dakisolatie", "description": "Professionele dakisolatie voor optimale energie-efficiëntie", "price": 2500.00, "service": 1, "activities": [ "Inspectie dak", "Plaatsen isolatiemateriaal", "Afwerking en controle" ], "image": "/images/products/dakisolatie.jpg", "wp_id": 12345 }

Create Product Response

{ "success": true, "message": "Product created successfully", "data": { "id": 42, "wp_id": 12345, "title": "Dakisolatie", "description": "Professionele dakisolatie voor optimale energie-efficiëntie", "price": "2500.00", "service": 1, "activities": [ "Inspectie dak", "Plaatsen isolatiemateriaal", "Afwerking en controle" ], "image": "/images/products/dakisolatie.jpg", "created_at": "2025-11-06T15:30:00.000000Z", "updated_at": "2025-11-06T15:30:00.000000Z" } }

Update Product

PUT /api/products/42

{ "title": "Dakisolatie Premium", "price": 2750.00 }

Get Product Details

GET /api/products/42

{ "success": true, "data": { "id": 42, "wp_id": 12345, "title": "Dakisolatie Premium", "description": "Professionele dakisolatie voor optimale energie-efficiëntie", "price": "2750.00", "service": 1, "activities": [ "Inspectie dak", "Plaatsen isolatiemateriaal", "Afwerking en controle" ], "image": "/images/products/dakisolatie.jpg", "created_at": "2025-11-06T15:30:00.000000Z", "updated_at": "2025-11-06T16:15:00.000000Z" } }

List Products with Filtering

GET /api/products/list?service=1&per_page=10

{ "success": true, "data": [ { "id": 42, "title": "Dakisolatie Premium", "price": "2750.00", "service": 1, "created_at": "2025-11-06T15:30:00.000000Z" } ], "pagination": { "current_page": 1, "per_page": 10, "total": 45, "last_page": 5 } }

Delete Product

DELETE /api/products/42

{ "success": true, "message": "Product deleted successfully" }