You've already forked wc-licensed-product
- Add API client examples for PHP, Python, JavaScript, curl, and C# - Create comprehensive REST API documentation in docs/client-examples/ - All examples include rate limit handling (HTTP 429) - Examples cover validate, status, and activate endpoints Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
WC Licensed Product API Client Examples
This directory contains example API clients for integrating with the WC Licensed Product REST API.
API Base URL
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 command examples
- php-client.php - PHP client class
- python-client.py - Python client class
- javascript-client.js - JavaScript/Node.js client class
- csharp-client.cs - C# client class
Response Format
All endpoints return JSON responses with the following structure:
Success Response (Validate)
{
"valid": true,
"license": {
"status": "active",
"domain": "example.com",
"expires_at": "2025-12-31",
"product_id": 123
}
}
Error Response
{
"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 |