Skip to content
WasFor
Go boela gae
Ditokomane/Mohlami API

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

MokgwaTselaMorero
GET/api/user/sitesLokeletša mafelo
POST/api/user/sitesHlama 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/settingsBala peakanyo ya PHP
PUT/api/user/sites/{id}/php/settingsDiphetolelo tša go phaela ka thoko
POST/api/user/sites/{id}/php/settings/resetSeta gape di-overrides
GET/api/user/sites/{id}/php/extensionsLenaneo la dikatološo
GET/api/user/databasesLenaneo la dipolokelo tša tshedimošo
POST/api/user/databasesHlama polokelo ya tshedimošo
GET/api/user/backupsLenaneo la diswantšho tša go tšewa ka lebelo
POST/api/user/backups/runHlohleletša bekapo
GET/api/user/ticketsLenaneo la dithekethe
POST/api/user/ticketsBula tekete

Lokeletša mafelo

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

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

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

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

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.

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

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:

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 gape di-override ka moka:

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

Dikatološo

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

Diphetogo tša katoloso di nyaka molaodi ge di nyaka diphuthelwana tša tshepedišo; ba kgopele ka thekethe.

Di-database le di-backup

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
}

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 yaGo ra gore
validation_failedTšhemo e tee goba tše ntši di gannwe
quota_exceededMoedi wa sephuthelwana o fihleletšwe
duplicate_domainDomain e šetše e le gona ka bogolo
not_foundMohlodi ka ntle ga akhaonto ya leswao
php_reload_failedPeakanyo 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
Last ntjhafatswa: 2026-12-01