# WC Licensed Product API Client Examples This directory contains example API clients for integrating with the WC Licensed Product REST API. ## API Base URL ```shell https://your-site.com/wp-json/wc-licensed-product/v1 ``` ## Available Endpoints | Endpoint | Method | Description | |----------|--------|-------------| | `/validate` | POST | Validate a license key for a specific domain | | `/status` | POST | Get the current status of a license | | `/activate` | POST | Activate a license on a domain | ## Rate Limiting The API is rate-limited to 30 requests per minute per IP address. If you exceed this limit, you'll receive a `429 Too Many Requests` response with a `Retry-After` header indicating when you can retry. ## Example Files - [curl.sh](curl.sh) - cURL command examples - [php-client.php](php-client.php) - PHP client class - [python-client.py](python-client.py) - Python client class - [javascript-client.js](javascript-client.js) - JavaScript/Node.js client class - [csharp-client.cs](csharp-client.cs) - C# client class ## Response Format All endpoints return JSON responses with the following structure: ### Success Response (Validate) ```json { "valid": true, "license": { "status": "active", "domain": "example.com", "expires_at": "2025-12-31", "product_id": 123 } } ``` ### Error Response ```json { "valid": false, "error": "license_not_found", "message": "License key not found." } ``` ## Error Codes | Code | Description | | ------ | ------------- | | `license_not_found` | The license key does not exist | | `license_expired` | The license has expired | | `license_revoked` | The license has been revoked | | `license_inactive` | The license is inactive | | `domain_mismatch` | The license is not valid for the provided domain | | `max_activations_reached` | Maximum number of domain activations reached | | `rate_limit_exceeded` | Too many requests, please wait and retry |