VPS.org API

Amaxwebhu e-REST API

I-API yeeSeva

Lawula iiseva zakho zeVPS ngokwenkqubo. Yenza, lungiselela, lawula, kwaye ubeke iliso kwiiseva zakho zabucala ezibonakalayo.

Iindawo zokugqibela 9 endpoints
Indlela Esisiseko /api/v1/servers
FUMANA /api/v1/servers/

Dwelisa Zonke Iiseva

Fumana uluhlu lwazo zonke iiseva kwiakhawunti yakho.

IiParamitha zoMbuzo

Ipharamitha Uhlobo Kufuneka Inkcazo
status umtya Hayi Hluza ngokwesimo seseva: iyasebenza, imisiwe, imisiwe
location umtya Hayi Hluza ngendawo yedatha

Isicelo somzekelo

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);

Impendulo yoMzekelo

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

Iikhowudi zeMeko yokuphendula

200 Uluhlu lweseva lufunyenwe ngempumelelo
401 Ayigunyaziswanga - Ithokheni ye-API engasebenziyo okanye engekhoyo
POST /api/v1/servers/

Yenza iSeva eNtsha

Sebenzisa iseva entsha yeVPS enoqwalaselo oluchaziweyo.

Cela iiParamitha zoMzimba

Ipharamitha Uhlobo Kufuneka Inkcazo
name umtya Ewe Igama leseva (iinombolo zamagama, ii-hyphens ziyavunyelwa)
plan_id inani elipheleleyo Ewe Isazisi sesicwangciso seVPS
os_id inani elipheleleyo Ewe Isazisi senkqubo yokusebenza
location umtya Ewe Ikhowudi yendawo yedatha
hostname umtya Hayi Igama lomncedisi (FQDN)
ssh_key_id inani elipheleleyo Hayi I-ID yesitshixo se-SSH ekufuneka ifakelwe
backups_enabled i-boolean Hayi Nika amandla ii-backups ezizenzekelayo (okwangoku: bubuxoki)

Isicelo somzekelo

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);

Impendulo yoMzekelo

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

Iikhowudi zeMeko yokuphendula

201 Iseva yenziwe ngempumelelo
400 Isicelo esibi - Iiparameter ezingavumelekanga
401 Ayigunyaziswanga - Ithokheni ye-API engasebenziyo okanye engekhoyo
402 Intlawulo Iyafuneka - Iikhredithi azanelanga
FUMANA /api/v1/servers/{server_id}/

Fumana Iinkcukacha zeSeva

Fumana ulwazi oluneenkcukacha malunga neseva ethile.

Iiparameter zeNdlela

Ipharamitha Uhlobo Kufuneka Inkcazo
server_id inani elipheleleyo Ewe I-ID yeseva eyahlukileyo

Isicelo somzekelo

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);

Impendulo yoMzekelo

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

Iikhowudi zeMeko yokuphendula

200 Iinkcukacha zeseva zifunyenwe ngempumelelo
401 Ayigunyaziswanga - Ithokheni ye-API engasebenziyo okanye engekhoyo
404 Ayifumaneki - Iseva ayikho
I-PUT /api/v1/servers/{server_id}/

Hlaziya iSeva

Hlaziya ubumbeko lweseva. Zonke iindawo ziyafuneka.

Iiparameter zeNdlela

Parameter Type Required Description
server_id integer Yes I-ID yeseva eyahlukileyo

Cela iiParamitha zoMzimba

Ipharamitha Uhlobo Kufuneka Inkcazo
name umtya Ewe Igama leseva
hostname umtya Ewe Igama lomncedisi (FQDN)
backups_enabled i-boolean Ewe Nika amandla/khubaza ii-backups ezizenzekelayo

Isicelo somzekelo

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())

Iikhowudi zeMeko yokuphendula

200 Iseva ihlaziywe ngempumelelo
400 Isicelo esibi - Iiparameter ezingavumelekanga
404 Ayifumaneki - Iseva ayikho
IPHETSHI /api/v1/servers/{server_id}/

Hlaziya iSeva ngokuyinxenye

Hlaziya amasimi athile eseva. Kuphela amasimi anikiweyo aya kuhlaziywa.

Isicelo somzekelo

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())
CIMA /api/v1/servers/{server_id}/

Cima iSeva

Cima iseva ngokusisigxina. Esi senzo asinakurhoxiswa.

Isicelo somzekelo

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)

Iikhowudi zeMeko yokuphendula

204 Iseva icinywe ngempumelelo
404 Ayifumaneki - Iseva ayikho
POST /api/v1/servers/{server_id}/start/

Qalisa iSeva

Umbane kwiseva emisiwe.

Isicelo somzekelo

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);

Impendulo yoMzekelo

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

Iikhowudi zeMeko yokuphendula

200 Umyalelo wokuqalisa iseva uthunyelwe ngempumelelo
400 Isicelo esibi - Iseva sele isebenza
404 Ayifumaneki - Iseva ayikho
POST /api/v1/servers/{server_id}/stop/

Misa iSeva

Vala iseva esebenzayo ngobubele.

Isicelo somzekelo

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())

Impendulo yoMzekelo

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

Qalisa kwakhona iSeva

Qala kwakhona iseva esebenzayo ngobubele.

Isicelo somzekelo

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())

Impendulo yoMzekelo

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

Iikhowudi zeMeko yokuphendula

200 Umyalelo wokuqalisa kwakhona iseva uthunyelwe ngempumelelo
400 Isicelo esibi - Iseva ayisebenzi
404 Ayifumaneki - Iseva ayikho