Skip to content
WasFor
Ar ais sa bhaile
Doiciméadúchán/Forbróir API

Ú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í

ModhConairCuspóir
GET/api/user/sitesLiosta láithreáin
POST/api/user/sitesCruthaigh 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/settingsLéigh cumraíocht PHP
PUT/api/user/sites/{id}/php/settingsSáraítear an nuashonrú
POST/api/user/sites/{id}/php/settings/resetSáraíonn athshocrú
GET/api/user/sites/{id}/php/extensionsLiosta síntí
GET/api/user/databasesLiosta bunachair shonraí
POST/api/user/databasesCruthaigh bunachar sonraí
GET/api/user/backupsDéan liosta de na pictiúir
POST/api/user/backups/runTruicear cúltaca
GET/api/user/ticketsLiosta ticéid
POST/api/user/ticketsOscail ticéad

Liosta láithreáin

http
GET /api/user/sites?page=1&per_page=25
Authorization: Bearer <token>
json
{
  "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

http
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

http
GET /api/user/sites/42/php/settings
json
{
  "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ú.

http
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ú:

json
{
  "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:

http
POST /api/user/sites/42/php/settings/reset

Eisínteachtaí

http
GET /api/user/sites/42/php/extensions
json
{
  "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í

http
POST /api/user/databases
{
  "name": "shop_prod",
  "user": "shop_user",
  "charset": "utf8mb4"
}
http
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ódBrí
validation_failedRéimse amháin nó níos mó diúltaithe
quota_exceededTeorainn an phacáiste bainte amach
duplicate_domainTá raon feidhme an fhearainn ann cheana féin
not_foundAcmhainn lasmuigh de chuntas an chomhartha
php_reload_failedBhí 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
Nuashonraithe is déanaí: 2026-12-01