API ya mosebedisi
Modiriši API o laola methopo yeo e lego ya moreki yo a netefaditšwego. Tsela ye nngwe le ye nngwe e na le sebaka: leswao la akhaonto e tee le ka se kgone go bala goba go ngwala datha ya akhaonto ye nngwe, gaešita le ka sešupo seo se phopholeditšwego.
Dintlha tša mafelelo
| Mokgwa | Tsela | Morero |
|---|---|---|
GET | /api/user/sites | Lokeletša mafelo |
POST | /api/user/sites | Hlama sebaka |
GET | /api/user/sites/{id} | Dintlha tša sebaka |
PATCH | /api/user/sites/{id} | Mpshafatša dipeakanyo |
DELETE | /api/user/sites/{id} | Phimola sebaka |
GET | /api/user/sites/{id}/php/settings | Bala peakanyo ya PHP |
PUT | /api/user/sites/{id}/php/settings | Diphetolelo tša go phaela ka thoko |
POST | /api/user/sites/{id}/php/settings/reset | Seta gape di-overrides |
GET | /api/user/sites/{id}/php/extensions | Lenaneo la dikatološo |
GET | /api/user/databases | Lenaneo la dipolokelo tša tshedimošo |
POST | /api/user/databases | Hlama polokelo ya tshedimošo |
GET | /api/user/backups | Lenaneo la diswantšho tša go tšewa ka lebelo |
POST | /api/user/backups/run | Hlohleletša bekapo |
GET | /api/user/tickets | Lenaneo la dithekethe |
POST | /api/user/tickets | Bula tekete |
Lokeletša mafelo
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 }
}Hlama 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"
}Netefatšo e gana domain yeo e šetšego e šomišwa ka akhaontong, tokumente ya root ka ntle ga legae la akhaonto le phetolelo ya PHP yeo e sa thekgwego. Bopa bjo bo atlegilego bo bušetša 201 ka selo sa sebaka.
Bala di-setting 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": []
}
}Diphetolelo tša go phaela ka thoko
Romela fela ditaelo tšeo o nyakago go di fetoša. Dinotlelo tše di tlogetšwego di boloka boleng bja tšona bja bjale; null e tloša go phaela ka thoko gomme e bušetša bohwa.
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"
}
}Ditekanyetšo tše di sa šomego di palelwa ka athomo — ga go selo seo se ngwadilwego ntle le ge taelo ye nngwe le ye nngwe e feta netefatšo:
{
"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 gape di-override ka moka:
POST /api/user/sites/42/php/settings/resetDikatološo
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"]
}
}Diphetogo tša katoloso di nyaka molaodi ge di nyaka diphuthelwana tša tshepedišo; ba kgopele ka thekethe.
Di-database le di-backup
POST /api/user/databases
{
"name": "shop_prod",
"user": "shop_user",
"charset": "utf8mb4"
}POST /api/user/backups/run
{
"scope": ["files", "database"],
"site_id": 42
}Mešomo ya bekapo e bušetša sešupo sa mošomo; poll GET /api/user/backups bakeng sa maemo go e na le go thibela kgopelo.
Diphošo
| Khoutu ya | Go ra gore |
|---|---|
validation_failed | Tšhemo e tee goba tše ntši di gannwe |
quota_exceeded | Moedi wa sephuthelwana o fihleletšwe |
duplicate_domain | Domain e šetše e le gona ka bogolo |
not_found | Mohlodi ka ntle ga akhaonto ya leswao |
php_reload_failed | Peakanyo e a šoma eupša go laetša gape go paletšwe |
Amanago
- [PHP runtime] (user-php.html) bakeng sa semantiki ya taelo
- API kakaretso bakeng sa auth le matlakala
- Admin API bakeng sa tshebetso ya sehlopha sa dikepe