???? API
??? ?? ?????? ?????? ????? ???? ????? API ???????.
????????
???? ???? ??????? ????? ??? Authorization:
Authorization: Bearer YOUR_API_TOKEN
????? ?????????
???? ?????????? ???? ??? ??????:
{
"success": true,
"data": { ... },
"message": "Description of the result"
}
???????? ?????:
{
"success": false,
"error": "Error description",
"code": 400
}
??????????
??? ???? ??????????
GET /api/saas/tenants
?????????:
| ??????? | ????? | ????? | ????? |
|---|---|---|---|
page | integer | ?? | ??? ?????? ??????? |
per_page | integer | ?? | ??????? ??? ???? (???????: 25? ????: 100) |
status | string | ?? | ??????? ??? ??????: active, inactive, trial |
???? ??? ?????????:
{
"success": true,
"data": {
"tenants": [
{
"id": 1,
"company_name": "Acme Corp",
"domain": "acme.yoursite.com",
"plan": "Professional",
"status": "active",
"created_at": "2024-01-15T10:30:00Z"
}
],
"total": 42,
"page": 1,
"per_page": 25
}
}
?????? ??? ?????? ????
GET /api/saas/tenants/{id}
???? ??? ?????????:
{
"success": true,
"data": {
"id": 1,
"company_name": "Acme Corp",
"domain": "acme.yoursite.com",
"plan_id": 2,
"plan_name": "Professional",
"status": "active",
"created_at": "2024-01-15T10:30:00Z",
"expires_at": "2024-02-15T10:30:00Z",
"usage": {
"customers": { "used": 24, "limit": 500 },
"invoices": { "used": 89, "limit": 1000 },
"projects": { "used": 5, "limit": 50 },
"staff": { "used": 3, "limit": 10 }
}
}
}
????? ??????
POST /api/saas/tenants
??????? ????:
| ??????? | ????? | ????? | ????? |
|---|---|---|---|
company_name | string | ??? | ??? ?????? |
email | string | ??? | ?????? ?????????? ??????? ??????? |
first_name | string | ??? | ????? ????? ??????? |
last_name | string | ??? | ??? ??????? ??????? |
plan_id | integer | ??? | ????? ?????? ??????? |
subdomain | string | ??? | ?????? ??????/??????? ??????? |
password | string | ?? | ???? ???? ?????? (????? ???????? ??? ?? ?????) |
????:
curl -X POST https://yoursite.com/api/saas/tenants \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company_name": "Acme Corp",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"plan_id": 2,
"subdomain": "acme"
}'