Skip to content
WasFor
Kgutlela hae
Litokomane/Moqapi oa API

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

MokhoaTselaMorero
GET/api/user/sitesEtsa lethathamo la libaka
POST/api/user/sitesTheha 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/settingsBala tlhophiso ea PHP
PUT/api/user/sites/{id}/php/settingsLiphetoho tsa ntlafatso
POST/api/user/sites/{id}/php/settings/resetSeta melato bocha
GET/api/user/sites/{id}/php/extensionsLethathamo la likeketso
GET/api/user/databasesEtsa lethathamo la li-database
POST/api/user/databasesEtsa polokelo ea boitsebiso
GET/api/user/backupsEtsa lethathamo la linepe
POST/api/user/backups/runQala bekapo
GET/api/user/ticketsEtsa lethathamo la litekete
POST/api/user/ticketsBula tekete

Etsa lethathamo la libaka

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 }
}

Theha sebaka

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"
}

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

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": []
  }
}

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.

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"
  }
}

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:

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"
  }
}

Seta liphetolelo tsohle hape:

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

Keketso

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"]
  }
}

Liphetoho tsa katoloso li hloka molaoli ha li hloka liphutheloana tsa sistimi; li kope ka tekete.

Databases le li-backups

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
}

Mesebetsi ea bekapo e khutlisetsa sesupo sa mosebetsi; khetha GET /api/user/backups bakeng sa boemo ho ena le ho thibela kopo.

Liphoso

KhoutuTlhaloso
validation_failedKarolo e le 'ngoe kapa tse ngata li hanngoe
quota_exceededTekanyetso ea sephutheloana e fihletsoe
duplicate_domainDomain e se e ntse e le teng ka kakaretso
not_foundMohloli o kantle ho ak'haonte ea token
php_reload_failedTokiso e nepahetse empa e hlolehile ho kenya hape

Tse amanang

E qetetse ho ntlafatsoa: 2026-12-01