API Reference
Comprehensive reference for Louis Lukkanit classes, methods, and configurations, including code snippets for developers.
curl -X GET https://api.example.com/v1/cms/pages \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"
const response = await fetch('https://api.example.com/v1/cms/pages', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
});
const data = await response.json();
import requests
response = requests.get(
'https://api.example.com/v1/cms/pages',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
)
data = response.json()
{
"data": [
{
"id": "page-123",
"title": "Home Page",
"slug": "home",
"content": "Welcome content"
}
],
"meta": {
"total": 50,
"per_page": 25
}
}
curl -X POST https://api.example.com/v1/pos/sales \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"items": [{"product_id": "prod-1", "quantity": 2}],
"customer_email": "customer@example.com"
}'
{
"error": "Unauthorized",
"message": "Invalid token"
}
Overview
Access the Louis Lukkanit API at https://api.example.com/v1 to manage CMS content, POS transactions, and business systems. Authenticate requests using Bearer tokens. All endpoints return JSON responses.
Review your {API_KEY} from the dashboard at https://dashboard.example.com before integrating.
CMS Endpoints
Manage pages and content.
POS Endpoints
Handle sales and inventory.
Configuration
Customize package behavior.
Authentication
Secure all requests with a Bearer token in the Authorization header.
Bearer {YOUR_TOKEN}.
application/json.
// Example: Fetch token first
const token = 'your-token-here';
fetch('https://api.example.com/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: 'user@example.com', password: 'pass' })
});
CMS Endpoints
Retrieve and manage CMS pages.
List Pages
Array of page objects.
Pagination metadata.
Pages per response, default 25, max 100.
POS Endpoints
Create a new point-of-sale transaction.
Prepare Payload
Include items and customer data.
Send POST Request
Use the endpoint below.
Fetch current stock levels.
import requests
response = requests.get(
'https://api.example.com/v1/pos/inventory',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
Laravel Package Integration
Integrate Louis Lukkanit packages into your Laravel application.
// config/louis-lukkanit.php
return [
'api_key' => env('LOUIS_API_KEY'),
'base_url' => 'https://api.example.com/v1',
];
use LouisLukkanit\CmsManager;
class PageController extends Controller
{
public function index()
{
$pages = CmsManager::pages()->get();
return view('pages.index', compact('pages'));
}
}
Configuration Options
| Key | Type | Default | Description |
|---|---|---|---|
api_key | string | null | Your {API_KEY} |
base_url | string | /v1 | API base endpoint |
timeout | integer | 30 | Request timeout in seconds |
Publish config with php artisan vendor:publish --tag=louis-config.
Error Handling
Common errors include 401 Unauthorized and 429 Rate Limited.
try {
$response = CmsManager::pages()->get();
} catch (Exception $e) {
if ($e->getCode() === 401) {
// Refresh token
}
}
Last updated today