User API
Mosebelisi API o laola lisebelisoa tseo e leng tsa moreki ea netefalitsoeng. Tsela e 'ngoe le e' ngoe e na le scoped: lets'oao la ak'haonte e le 'ngoe ha le khone ho bala kapa ho ngola data ea ak'haonte e' ngoe, leha e na le sekhetho se hakantsoeng.
Lintlha tsa ho qetela
| Mokhoa | Tsela | Morero |
|---|---|---|
GET | /api/user/sites | Etsa lethathamo la libaka |
POST | /api/user/sites | Theha sebaka |
GET | /api/user/sites/{id} | Lintlha tsa sebaka |
PATCH | /api/user/sites/{id} | Litlhophiso tsa ntlafatso |
DELETE | /api/user/sites/{id} | Hlakola sebaka |
GET | /api/user/sites/{id}/php/settings | Bala tlhophiso ea PHP |
PUT | /api/user/sites/{id}/php/settings | Liphetoho tsa ntlafatso |
POST | /api/user/sites/{id}/php/settings/reset | Seta melato bocha |
GET | /api/user/sites/{id}/php/extensions | Lethathamo la likeketso |
GET | /api/user/databases | Etsa lethathamo la li-database |
POST | /api/user/databases | Etsa polokelo ea boitsebiso |
GET | /api/user/backups | Etsa lethathamo la linepe |
POST | /api/user/backups/run | Qala bekapo |
GET | /api/user/tickets | Etsa lethathamo la litekete |
POST | /api/user/tickets | Bula tekete |
Etsa lethathamo la libaka
GET /api/user/sites?page=1&per_page=25
Authorization: Bearer <token>{
"ok": true,
"data": [
{
"id": 42,
"domain": "app.example.com",
"document_root": "/home/acme/sites/app.example.com/public",
"php_version": "8.3",
"ssl": { "status": "active", "expires_at": "2027-02-18T00:00:00Z" },
"disk_used_mb": 1840,
"status": "active"
}
],
"meta": { "page": 1, "per_page": 25, "total": 1 }
}Theha sebaka
POST /api/user/sites
Content-Type: application/json
{
"domain": "shop.example.com",
"php_version": "8.3",
"document_root": "/home/acme/sites/shop.example.com/public"
}Netefatso e hana sebaka se seng se ntse se sebelisoa akhaonteng, tokomane ea root kantle ho lehae la ak'haonte le mofuta o sa tšehetsoeng oa PHP. Moqapi o atlehileng o khutlisa 201 ka ntho ea sebaka sa marang-rang.
Bala litlhophiso tsa PHP
GET /api/user/sites/42/php/settings{
"ok": true,
"data": {
"php_version": "8.3",
"runtime": "fpm",
"supported": [
"memory_limit", "max_execution_time", "max_input_time",
"upload_max_filesize", "post_max_size", "max_input_vars",
"display_errors", "error_reporting", "date.timezone",
"session.gc_maxlifetime"
],
"inherited": {
"memory_limit": "128M",
"max_execution_time": "60",
"post_max_size": "64M"
},
"overrides": {
"memory_limit": "256M"
},
"effective": {
"memory_limit": "256M",
"max_execution_time": "60",
"post_max_size": "64M"
},
"limits": {
"memory_limit": { "min": "64M", "max": "1G" },
"max_execution_time": { "min": 30, "max": 300 }
},
"warnings": []
}
}Liphetoho tsa ntlafatso
Romella feela litaelo tseo u batlang ho li fetola. Linotlolo tse siiloeng li boloka boleng ba tsona ba hajoale; null e tlosa ho fetelletsa le ho khutlisetsa lefa.
PUT /api/user/sites/42/php/settings
Content-Type: application/json
{
"overrides": {
"memory_limit": "256M",
"upload_max_filesize": "128M",
"post_max_size": "128M",
"date.timezone": "Asia/Shanghai"
}
}Maemo a sa sebetseng a hloleha ka mokhoa oa athomo - ha ho letho le ngotsoeng ntle le haeba taelo e 'ngoe le e 'ngoe e fetisa netefatso:
{
"ok": false,
"error": {
"code": "validation_failed",
"message": "post_max_size must be greater than or equal to upload_max_filesize",
"fields": { "post_max_size": "lt_upload_max_filesize" },
"request_id": "req_01J8Z4A2"
}
}Seta liphetolelo tsohle hape:
POST /api/user/sites/42/php/settings/resetKeketso
GET /api/user/sites/42/php/extensions{
"ok": true,
"data": {
"php_version": "8.3",
"loaded": ["bcmath", "curl", "gd", "intl", "mbstring", "opcache", "openssl", "pdo_mysql", "redis", "zip"],
"available": ["imagick", "sodium", "xdebug"]
}
}Liphetoho tsa katoloso li hloka molaoli ha li hloka liphutheloana tsa sistimi; li kope ka tekete.
Databases le li-backups
POST /api/user/databases
{
"name": "shop_prod",
"user": "shop_user",
"charset": "utf8mb4"
}POST /api/user/backups/run
{
"scope": ["files", "database"],
"site_id": 42
}Mesebetsi ea bekapo e khutlisetsa sesupo sa mosebetsi; khetha GET /api/user/backups bakeng sa boemo ho ena le ho thibela kopo.
Liphoso
| Khoutu | Tlhaloso |
|---|---|
validation_failed | Karolo e le 'ngoe kapa tse ngata li hanngoe |
quota_exceeded | Tekanyetso ea sephutheloana e fihletsoe |
duplicate_domain | Domain e se e ntse e le teng ka kakaretso |
not_found | Mohloli o kantle ho ak'haonte ea token |
php_reload_failed | Tokiso e nepahetse empa e hlolehile ho kenya hape |
Tse amanang
- PHP nako ea ho sebetsa bakeng sa semantiki ea litaelo
- API kakaretso bakeng sa auth le pagination
- Motsamaisi API bakeng sa ts'ebetso ea likepe