php artisan serve or php -S localhost:8000 -t publicAll tenant-specific endpoints require the X-Tenant-API-Token header with a valid API token.
curl -X POST http://localhost:8000/api/tenants \
-H "Content-Type: application/json" \
-d '{
"name": "My Company",
"description": "Company description",
"address": "123 Main St",
"phone": "+1234567890",
"domain": "mycompany.com",
"api_enabled": true
}'
Response includes API token:
{
"success": true,
"data": {
"id": 1,
"name": "My Company",
"api_token": "your-generated-api-token-here"
}
}
curl -X POST http://localhost:8000/api/tickets \
-H "Content-Type: application/json" \
-H "X-Tenant-API-Token: YOUR_API_TOKEN" \
-d '{
"title": "Login Issue",
"description": "Cannot login to system",
"priority": "high",
"category_id": 1
}'
curl -X GET http://localhost:8000/api/tickets \
-H "X-Tenant-API-Token: YOUR_API_TOKEN"
curl -X GET http://localhost:8000/api/tickets/1 \
-H "X-Tenant-API-Token: YOUR_API_TOKEN"
curl -X PUT http://localhost:8000/api/tickets/1 \
-H "Content-Type: application/json" \
-H "X-Tenant-API-Token: YOUR_API_TOKEN" \
-d '{
"title": "Updated Title",
"status": "in_progress"
}'
curl -X DELETE http://localhost:8000/api/tickets/1 \
-H "X-Tenant-API-Token: YOUR_API_TOKEN"
curl -X GET http://localhost:8000/api/tenant \
-H "X-Tenant-API-Token: YOUR_API_TOKEN"
chmod +x complete_api_test.sh
./complete_api_test.sh
This script will:
php artisan test:ticket-api --tenant-slug=your-tenant --api-token=your-token
All responses follow this structure:
{
"success": true|false,
"message": "Response message",
"data": { ... } | null
}
For validation errors:
{
"success": false,
"message": "Validation error",
"errors": {
"field_name": ["Error message"]
}
}
401: Invalid or missing API token403: API access disabled for tenant404: Resource not found422: Validation error500: Server error