Úsáideoir API
Bainistíonn an t-úsáideoir API acmhainní a bhaineann leis an gcustaiméir fíordheimhnithe. Déantar gach cosán a scóip: ní féidir le comhartha do chuntas amháin sonraí chuntais eile a léamh ná a scríobh, fiú le haitheantóir tomhaiste.
Críochphointí
| Modh | Conair | Cuspóir |
|---|---|---|
GET | /api/user/sites | Liosta láithreáin |
POST | /api/user/sites | Cruthaigh suíomh |
GET | /api/user/sites/{id} | Sonraí suímh |
PATCH | /api/user/sites/{id} | Nuashonraigh socruithe |
DELETE | /api/user/sites/{id} | Scrios suíomh |
GET | /api/user/sites/{id}/php/settings | Léigh cumraíocht PHP |
PUT | /api/user/sites/{id}/php/settings | Sáraítear an nuashonrú |
POST | /api/user/sites/{id}/php/settings/reset | Sáraíonn athshocrú |
GET | /api/user/sites/{id}/php/extensions | Liosta síntí |
GET | /api/user/databases | Liosta bunachair shonraí |
POST | /api/user/databases | Cruthaigh bunachar sonraí |
GET | /api/user/backups | Déan liosta de na pictiúir |
POST | /api/user/backups/run | Truicear cúltaca |
GET | /api/user/tickets | Liosta ticéid |
POST | /api/user/tickets | Oscail ticéad |
Liosta láithreáin
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 }
}Cruthaigh suíomh
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"
}Diúltaíonn bailíochtú fearann atá in úsáid cheana féin sa chuntas, doiciméad root lasmuigh de theach an chuntais agus leagan PHP nach dtacaítear leis. Filleann cruth rathúil 201 leis an réad suímh.
Léigh socruithe 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": []
}
}Sáraítear an nuashonrú
Ná seol ach na treoracha is mian leat a athrú. Coinníonn eochracha fágtha ar lár a luach reatha; Cuireann null deireadh le sáraíocht agus déanann sé oidhreacht a athchóiriú.
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"
}
}Teipeann go hadamhach ar luachanna neamhbhailí — ní scríobhtar tada mura n-éiríonn le gach treoir an bailíochtú:
{
"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"
}
}Athshocraigh gach sáraíocht:
POST /api/user/sites/42/php/settings/resetEisínteachtaí
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"]
}
}Éilíonn athruithe síneadh riarthóir nuair a bhíonn pacáistí córais de dhíth orthu; iarraidh iad trí thicéad.
Bunachair sonraí agus cúltacaí
POST /api/user/databases
{
"name": "shop_prod",
"user": "shop_user",
"charset": "utf8mb4"
}POST /api/user/backups/run
{
"scope": ["files", "database"],
"site_id": 42
}Filleann poist chúltaca aitheantóir poist; vótaíocht GET /api/user/backups le haghaidh stádais seachas bac a chur ar an iarratas.
Earráidí
| Cód | Brí |
|---|---|
validation_failed | Réimse amháin nó níos mó diúltaithe |
quota_exceeded | Teorainn an phacáiste bainte amach |
duplicate_domain | Tá raon feidhme an fhearainn ann cheana féin |
not_found | Acmhainn lasmuigh de chuntas an chomhartha |
php_reload_failed | Bhí an chumraíocht bailí ach níor éirigh leis an athlódáil |
Gaolmhar
- [Am rite PHP] (user-php.html) le haghaidh séimeantaice treorach
- Forbhreathnú API don údarás agus don leathanach
- Riarachán API le haghaidh oibríochtaí cabhlaigh