VPS.org API

REST API 문서

백업 API

서버 백업을 프로그래밍 방식으로 관리하세요. 서버 백업 목록을 확인하고, 생성, 복원 및 삭제할 수 있습니다.

엔드포인트 3 endpoints
기본 경로 /api/v1/backups
얻다 /api/v1/backups/

모든 백업 목록 보기

서버에 저장된 모든 백업 목록을 가져옵니다.

쿼리 매개변수

매개변수 유형 필수의 설명
server_id integer 아니요 서버 ID로 백업을 필터링합니다.
backup_type string 아니요 유형별 필터링: manual , automatic

예시 요청

cURL
Python
JavaScript
curl -X GET "https://admin.vps.org/api/v1/backups/?server_id=12345" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

url = "https://admin.vps.org/api/v1/backups/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
params = {"server_id": 12345}

response = requests.get(url, headers=headers, params=params)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/backups/?server_id=12345', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const backups = await response.json();
console.log(backups);

예시 답변

{
  "count": 3,
  "results": [
    {
      "id": 501,
      "server": {
        "id": 12345,
        "name": "web-server-01"
      },
      "backup_type": "automatic",
      "status": "completed",
      "size_mb": 4523,
      "created_at": "2025-01-16T03:00:00Z",
      "expires_at": "2025-02-16T03:00:00Z",
      "description": "Automatic daily backup"
    },
    {
      "id": 499,
      "server": {
        "id": 12345,
        "name": "web-server-01"
      },
      "backup_type": "manual",
      "status": "completed",
      "size_mb": 4456,
      "created_at": "2025-01-14T10:30:00Z",
      "expires_at": null,
      "description": "Pre-update backup"
    },
    {
      "id": 495,
      "server": {
        "id": 12345,
        "name": "web-server-01"
      },
      "backup_type": "automatic",
      "status": "completed",
      "size_mb": 4389,
      "created_at": "2025-01-15T03:00:00Z",
      "expires_at": "2025-02-15T03:00:00Z",
      "description": "Automatic daily backup"
    }
  ]
}

응답 상태 코드

200 백업 목록을 성공적으로 가져왔습니다.
401 권한 없음 - 인증 토큰이 유효하지 않거나 누락되었습니다.
우편 /api/v1/backups/

수동 백업 생성

서버를 수동으로 백업하십시오. 수동 백업은 자동으로 만료되지 않습니다.

요청 본문 매개변수

매개변수 유형 필수의 설명
server_id integer 백업할 서버의 ID
description string 아니요 백업에 대한 선택적 설명

예시 요청

cURL
Python
JavaScript
PHP
curl -X POST "https://admin.vps.org/api/v1/backups/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "server_id": 12345,
    "description": "Pre-deployment backup"
  }'
import requests

url = "https://admin.vps.org/api/v1/backups/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "server_id": 12345,
    "description": "Pre-deployment backup"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/backups/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    server_id: 12345,
    description: 'Pre-deployment backup'
  })
});

const backup = await response.json();
console.log(backup);
$data = [
    'server_id' => 12345,
    'description' => 'Pre-deployment backup'
];

$ch = curl_init('https://admin.vps.org/api/v1/backups/');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$backup = json_decode($response, true);
curl_close($ch);

예시 답변

{
  "id": 502,
  "server": {
    "id": 12345,
    "name": "web-server-01"
  },
  "backup_type": "manual",
  "status": "in_progress",
  "size_mb": null,
  "created_at": "2025-01-16T15:45:00Z",
  "expires_at": null,
  "description": "Pre-deployment backup",
  "message": "Backup is being created. This may take several minutes depending on server size."
}

응답 상태 코드

201 백업 생성이 성공적으로 시작되었습니다.
400 잘못된 요청 - 유효하지 않은 매개변수 또는 잘못된 형식의 요청입니다.
401 권한 없음 - 인증 토큰이 유효하지 않거나 누락되었습니다.
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.
메모: 서버당 최대 10개의 수동 백업을 생성할 수 있습니다. 자동 백업은 사용 중인 요금제의 백업 보존 정책(일반적으로 7~30일)에 따라 보존됩니다.
삭제 /api/v1/backups/{backup_id}/

삭제 백업

백업 파일을 영구적으로 삭제합니다. 이 작업은 되돌릴 수 없습니다.

경로 매개변수

매개변수 유형 필수의 설명
backup_id integer 고유 백업 ID

예시 요청

cURL
Python
JavaScript
curl -X DELETE "https://admin.vps.org/api/v1/backups/501/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

backup_id = 501
url = f"https://admin.vps.org/api/v1/backups/{backup_id}/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.delete(url, headers=headers)
print(response.status_code)
const backupId = 501;
const response = await fetch(`https://admin.vps.org/api/v1/backups/${backupId}/`, {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

console.log(response.status);

응답 상태 코드

204 백업이 성공적으로 삭제되었습니다.
401 권한 없음 - 인증 토큰이 유효하지 않거나 누락되었습니다.
404 찾을 수 없음 - 백업 파일이 존재하지 않습니다.
경고: 백업 파일을 삭제하면 영구적으로 삭제되며 복구할 수 없습니다. 삭제하기 전에 해당 백업 파일이 더 이상 필요하지 않은지 확인하십시오.

백업에서 복원하기

백업에서 서버를 복원하려면 서버 API 복원 엔드포인트를 사용하십시오.

POST /api/v1/servers/{server_id}/restore/
{
  "backup_id": 501
}

서버 복구에 대한 자세한 내용은 다음을 참조하십시오. 서버 API 문서.

백업 모범 사례