VPS.org API

REST API 문서

서버 API

VPS 서버를 프로그래밍 방식으로 관리하세요. 가상 사설 서버를 생성, 구성, 제어 및 모니터링할 수 있습니다.

엔드포인트 9
기본 경로 /api/v1/servers
얻다 /api/v1/servers/

모든 서버 목록 보기

계정에 있는 모든 서버 목록을 가져옵니다.

쿼리 매개변수

매개변수 유형 필수의 설명
status 아니요 서버 상태별 필터링: 활성, 중지됨, 일시 중단됨
location 아니요 데이터센터 위치로 필터링

예시 요청

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

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

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

const servers = await response.json();
console.log(servers);
$ch = curl_init('https://admin.vps.org/api/v1/servers/');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

예시 답변

{
  "count": 2,
  "results": [
    {
      "id": 12345,
      "name": "web-server-01",
      "hostname": "web01.example.com",
      "status": "active",
      "ip_address": "203.0.113.10",
      "location": "us-west",
      "plan": {
        "id": 1,
        "name": "Standard VPS",
        "vcpus": 2,
        "memory": 4096,
        "storage": 80
      },
      "os": {
        "id": 5,
        "name": "Ubuntu 22.04 LTS"
      },
      "created_at": "2025-01-10T14:30:00Z",
      "updated_at": "2025-01-15T10:20:00Z"
    },
    {
      "id": 12346,
      "name": "db-server-01",
      "hostname": "db01.example.com",
      "status": "active",
      "ip_address": "203.0.113.11",
      "location": "us-east",
      "plan": {
        "id": 2,
        "name": "Performance VPS",
        "vcpus": 4,
        "memory": 8192,
        "storage": 160
      },
      "os": {
        "id": 3,
        "name": "Debian 12"
      },
      "created_at": "2025-01-12T09:15:00Z",
      "updated_at": "2025-01-16T08:45:00Z"
    }
  ]
}

응답 상태 코드

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

새 서버 생성

지정된 구성으로 새 VPS 서버를 배포합니다.

요청 본문 매개변수

매개변수 유형 필수의 설명
name 서버 이름 (영숫자, 하이픈 사용 가능)
plan_id 정수 VPS 플랜의 ID
os_id 정수 운영 체제 ID
location 데이터센터 위치 코드
hostname 아니요 서버 호스트 이름(FQDN)
ssh_key_id 정수 아니요 SSH 키 ID를 설치하세요
backups_enabled 부울 아니요 자동 백업 활성화(기본값: 비활성화)

예시 요청

cURL
Python
JavaScript
PHP
curl -X POST "https://admin.vps.org/api/v1/servers/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web-server-02",
    "plan_id": 1,
    "os_id": 5,
    "location": "us-west",
    "hostname": "web02.example.com",
    "backups_enabled": true
  }'
import requests

url = "https://admin.vps.org/api/v1/servers/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "name": "web-server-02",
    "plan_id": 1,
    "os_id": 5,
    "location": "us-west",
    "hostname": "web02.example.com",
    "backups_enabled": True
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/servers/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'web-server-02',
    plan_id: 1,
    os_id: 5,
    location: 'us-west',
    hostname: 'web02.example.com',
    backups_enabled: true
  })
});

const server = await response.json();
console.log(server);
$data = [
    'name' => 'web-server-02',
    'plan_id' => 1,
    'os_id' => 5,
    'location' => 'us-west',
    'hostname' => 'web02.example.com',
    'backups_enabled' => true
];

$ch = curl_init('https://admin.vps.org/api/v1/servers/');
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);
$server = json_decode($response, true);
curl_close($ch);

예시 답변

{
  "id": 12347,
  "name": "web-server-02",
  "hostname": "web02.example.com",
  "status": "provisioning",
  "ip_address": null,
  "location": "us-west",
  "plan": {
    "id": 1,
    "name": "Standard VPS",
    "vcpus": 2,
    "memory": 4096,
    "storage": 80
  },
  "os": {
    "id": 5,
    "name": "Ubuntu 22.04 LTS"
  },
  "backups_enabled": true,
  "created_at": "2025-01-16T15:30:00Z",
  "updated_at": "2025-01-16T15:30:00Z",
  "message": "Server is being provisioned. This may take 2-5 minutes."
}

응답 상태 코드

201 서버가 성공적으로 생성되었습니다.
400 잘못된 요청 - 잘못된 매개변수
401 권한 없음 - API 토큰이 유효하지 않거나 누락되었습니다.
402 결제 필요 - 잔액 부족
얻다 /api/v1/servers/{server_id}/

서버 정보 가져오기

특정 서버에 대한 자세한 정보를 검색합니다.

경로 매개변수

매개변수 유형 필수의 설명
server_id 정수 고유 서버 ID

예시 요청

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

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

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

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

예시 답변

{
  "id": 12345,
  "name": "web-server-01",
  "hostname": "web01.example.com",
  "status": "active",
  "ip_address": "203.0.113.10",
  "ipv6_address": "2001:0db8::1",
  "location": "us-west",
  "plan": {
    "id": 1,
    "name": "Standard VPS",
    "vcpus": 2,
    "memory": 4096,
    "storage": 80,
    "bandwidth": 2048
  },
  "os": {
    "id": 5,
    "name": "Ubuntu 22.04 LTS"
  },
  "backups_enabled": true,
  "resource_usage": {
    "cpu_percent": 23.5,
    "memory_used": 2048,
    "disk_used": 35,
    "bandwidth_used": 450
  },
  "created_at": "2025-01-10T14:30:00Z",
  "updated_at": "2025-01-16T15:45:00Z"
}

응답 상태 코드

200 서버 정보를 성공적으로 가져왔습니다.
401 권한 없음 - API 토큰이 유효하지 않거나 누락되었습니다.
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.
놓다 /api/v1/servers/{server_id}/

업데이트 서버

서버 구성을 업데이트하세요. 모든 필드를 입력해야 합니다.

경로 매개변수

Parameter Type Required Description
server_id integer Yes 고유 서버 ID

요청 본문 매개변수

매개변수 유형 필수의 설명
name 서버 이름
hostname 서버 호스트 이름(FQDN)
backups_enabled 부울 자동 백업 활성화/비활성화

예시 요청

cURL
Python
curl -X PUT "https://admin.vps.org/api/v1/servers/12345/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web-server-updated",
    "hostname": "web-updated.example.com",
    "backups_enabled": true
  }'
import requests

server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "name": "web-server-updated",
    "hostname": "web-updated.example.com",
    "backups_enabled": True
}

response = requests.put(url, headers=headers, json=data)
print(response.json())

응답 상태 코드

200 서버 업데이트가 성공적으로 완료되었습니다.
400 잘못된 요청 - 잘못된 매개변수
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.
반점 /api/v1/servers/{server_id}/

서버 부분 업데이트

특정 서버 필드를 업데이트합니다. 제공된 필드만 업데이트됩니다.

예시 요청

cURL
Python
curl -X PATCH "https://admin.vps.org/api/v1/servers/12345/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "new-server-name"
  }'
import requests

server_id = 12345
url = f"https://admin.vps.org/api/v1/servers/{server_id}/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {"name": "new-server-name"}

response = requests.patch(url, headers=headers, json=data)
print(response.json())
삭제 /api/v1/servers/{server_id}/

서버 삭제

서버를 영구적으로 삭제합니다. 이 작업은 되돌릴 수 없습니다.

예시 요청

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

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

response = requests.delete(url, headers=headers)
print(response.status_code)

응답 상태 코드

204 서버가 성공적으로 삭제되었습니다.
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.
우편 /api/v1/servers/{server_id}/start/

서버 시작

정지된 서버의 전원을 켜세요.

예시 요청

cURL
Python
JavaScript
curl -X POST "https://admin.vps.org/api/v1/servers/12345/start/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

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

response = requests.post(url, headers=headers)
print(response.json())
const serverId = 12345;
const response = await fetch(`https://admin.vps.org/api/v1/servers/${serverId}/start/`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

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

예시 답변

{
  "status": "success",
  "message": "Server is starting",
  "server": {
    "id": 12345,
    "name": "web-server-01",
    "status": "starting"
  }
}

응답 상태 코드

200 서버 시작 명령이 성공적으로 전송되었습니다.
400 잘못된 요청 - 서버가 이미 실행 중입니다.
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.
우편 /api/v1/servers/{server_id}/stop/

서버 중지

실행 중인 서버를 안전하게 종료합니다.

예시 요청

cURL
Python
curl -X POST "https://admin.vps.org/api/v1/servers/12345/stop/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

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

response = requests.post(url, headers=headers)
print(response.json())

예시 답변

{
  "status": "success",
  "message": "Server is stopping",
  "server": {
    "id": 12345,
    "name": "web-server-01",
    "status": "stopping"
  }
}
우편 /api/v1/servers/{server_id}/reboot/

서버 재부팅

실행 중인 서버를 정상적으로 재시작합니다.

예시 요청

cURL
Python
curl -X POST "https://admin.vps.org/api/v1/servers/12345/reboot/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

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

response = requests.post(url, headers=headers)
print(response.json())

예시 답변

{
  "status": "success",
  "message": "Server is rebooting",
  "server": {
    "id": 12345,
    "name": "web-server-01",
    "status": "rebooting"
  }
}

응답 상태 코드

200 서버 재부팅 명령이 성공적으로 전송되었습니다.
400 잘못된 요청 - 서버가 실행 중이 아닙니다.
404 서버를 찾을 수 없음 - 서버가 존재하지 않습니다.