사용자 API
사용자 API는 인증된 고객에 속한 리소스를 관리합니다. 모든 경로에는 범위가 지정됩니다. 한 계정의 토큰은 추측된 식별자가 있더라도 다른 계정의 데이터를 읽거나 쓸 수 없습니다.
엔드포인트
| 방법 | 길 | 목적 |
|---|---|---|
GET | /api/user/sites | 사이트 나열 |
POST | /api/user/sites | 사이트 만들기 |
GET | /api/user/sites/{id} | 사이트 세부정보 |
PATCH | /api/user/sites/{id} | 업데이트 설정 |
DELETE | /api/user/sites/{id} | 사이트 삭제 |
GET | /api/user/sites/{id}/php/settings | PHP 구성 읽기 |
PUT | /api/user/sites/{id}/php/settings | 업데이트 재정의 |
POST | /api/user/sites/{id}/php/settings/reset | 재정의 재설정 |
GET | /api/user/sites/{id}/php/extensions | 목록 확장자 |
GET | /api/user/databases | 데이터베이스 나열 |
POST | /api/user/databases | 데이터베이스 만들기 |
GET | /api/user/backups | 스냅샷 나열 |
POST | /api/user/backups/run | 백업 트리거 |
GET | /api/user/tickets | 티켓 나열 |
POST | /api/user/tickets | 티켓 오픈 |
사이트 나열
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 }
}사이트 만들기
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"
}유효성 검사에서는 계정에서 이미 사용된 도메인, 계정 홈 외부의 문서 루트 및 지원되지 않는 PHP 버전을 거부합니다. 성공적인 생성은 사이트 개체와 함께 201를 반환합니다.
PHP 설정 읽기
http
GET /api/user/sites/42/php/settingsjson
{
"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": []
}
}업데이트 재정의
변경하려는 지시문만 보냅니다. 생략된 키는 현재 값을 유지합니다. null 재정의를 제거하고 상속을 복원합니다.
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"
}
}잘못된 값은 원자적으로 실패합니다. 모든 지시문이 유효성 검사를 통과하지 않으면 아무 것도 기록되지 않습니다.
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"
}
}모든 재정의를 재설정합니다.
http
POST /api/user/sites/42/php/settings/reset확장
http
GET /api/user/sites/42/php/extensionsjson
{
"ok": true,
"data": {
"php_version": "8.3",
"loaded": ["bcmath", "curl", "gd", "intl", "mbstring", "opcache", "openssl", "pdo_mysql", "redis", "zip"],
"available": ["imagick", "sodium", "xdebug"]
}
}확장 변경에는 시스템 패키지가 필요할 때 관리자가 필요합니다. 티켓을 통해 요청하세요.
데이터베이스 및 백업
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
}백업 작업은 작업 식별자를 반환합니다. 요청을 차단하는 대신 GET /api/user/backups 상태를 폴링하세요.
오류
| 암호 | 의미 |
|---|---|
validation_failed | 하나 이상의 필드가 거부되었습니다. |
quota_exceeded | 패키지 한도에 도달했습니다. |
duplicate_domain | 범위에 도메인이 이미 존재합니다. |
not_found | 토큰 계정 외부의 리소스 |
php_reload_failed | 구성은 유효하지만 다시 로드에 실패했습니다. |