Skip to content
WasFor
Go boela gae
Tokomane/Motlhabolodi API

API ya modirisi

Modirisi API o laola didirisiwa tse e leng tsa moreki yo o netefaditsweng. Tsela nngwe le nngwe e na le sekoupu: letshwao la akhaonto e le nngwe ga le kgone go bala kgotsa go kwala tshedimosetso ya akhaonto e nngwe, le fa e le ka sesupo se se fopholediwang.

Dintlha tsa bokhutlo

MokgwaTselaBoikaelelo
WFP0XWFP0XLenaane la mafelo
WFP0XWFP0XTlhama saete
WFP0XWFP0XDintlha tsa lefelo
WFP0XWFP0XNtšhwafatsa diseting
WFP0XWFP0XPhimola saete
WFP0XWFP0XBuisa thulaganyo ya PHP
WFP0XWFP0XNtšhwafatsa phimolo
WFP0XWFP0XSeta gape diphetolo
WFP0XWFP0XDikatoloso tsa lenaane
WFP0XWFP0XLenaane la dipolokelotshedimosetso
WFP0XWFP0XTlhama polokelotshedimosetso
WFP0XWFP0XLenaane la dinepe
WFP0XWFP0XTlhotlheletsa bekapo
WFP0XWFP0XLenaane la dithekete
WFP0XWFP0XBula thekete

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

Tlhama saete

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 gana domeine e e setseng e dirisiwa mo akhaontong, tokomane ya root kwa ntle ga legae la akhaonto le mofuta wa PHP o o sa tshegediweng. Go tlhama go go atlegileng go busetsa 201 ka selo sa saete.

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

Ntšhwafatsa phimolo

Romela fela ditaelo tse o batlang go di fetola. Dinotlolo tse di tlogetsweng di boloka boleng jwa tsone jwa ga jaana; null e tlosa go tlola le go busetsa boswa.

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

Dipalo tse di sa direng di palelwa ka atomo — ga go sepe se se kwalwang ntle le fa taelo nngwe le nngwe e feta 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 gape diphetolo tsotlhe:

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

Dikatoloso

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 tsa katoloso di tlhoka motsamaisi fa di tlhoka diphuthelwana tsa tsamaiso; di kope ka thekete.

Dipolokelotshedimosetso le dibekapo

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
}

Ditiro tsa bekapo di busetsa sesupo sa tiro; poll GET /api/user/backups bakeng sa boemo ho ena le ho thibela kopo.

Diphoso

KhoutuBokao
WFP0XKarolo e le nngwe kgotsa go feta e gannwe
WFP0XTekanyetso ya sephuthelwana e fitlheletswe
WFP0XDomeine e setse e le teng mo sekopong
WFP0XMotswedi o o kwa ntle ga akhaonto ya letshwao
WFP0XThulaganyo e a siama mme ga e a laisa gape

Amana

E tlhabolotswe labofelo: 2026-12-01