Liostaich na Frithealaichean Uile
Faigh liosta de na frithealaichean uile sa chunntas agad.
Paramadairean a' Cheist
Paramadair
Seòrsa
Riatanach
Tuairisgeul
status
sreang
Chan eil
Criathraich a rèir inbhe an fhrithealaiche: gnìomhach, stadte, crochte
location
sreang
Chan eil
Criathraich a rèir àite an ionaid dàta
Eisimpleir Iarrtais
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"
Copy
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())
Copy
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);
Copy
$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);
Copy
Eisimpleir Freagairt
{
"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"
}
]
}
Còdan Inbhe Freagairt
200
Chaidh liosta an fhrithealaiche fhaighinn air ais gu soirbheachail
401
Gun ùghdarras - Comharra API neo-dhligheach no a dhìth
Cruthaich Frithealaiche Ùr
Cuir frithealaiche VPS ùr an sàs le rèiteachadh sònraichte.
Paramadairean Corp Iarrtais
Paramadair
Seòrsa
Riatanach
Tuairisgeul
name
sreang
Tha
Ainm an fhrithealaiche (alfa-àireamhach, ceadaichte ceanglaichean)
plan_id
slàn-shluaigh
Tha
ID a’ phlana VPS
os_id
slàn-shluaigh
Tha
ID an t-siostaim obrachaidh
location
sreang
Tha
Còd àite an ionad dàta
hostname
sreang
Chan eil
Ainm-aoigheachd an fhrithealaiche (FQDN)
ssh_key_id
slàn-shluaigh
Chan eil
ID iuchair SSH ri stàladh
backups_enabled
boolean
Chan eil
Cuir cùl-taicean fèin-ghluasadach an gnìomh (bun-roghainn: meallta)
Eisimpleir Iarrtais
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
}'
Copy
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())
Copy
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);
Copy
$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);
Copy
Eisimpleir Freagairt
{
"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."
}
Còdan Inbhe Freagairt
201
Chaidh am frithealaiche a chruthachadh gu soirbheachail
400
Droch Iarrtas - Paramadairean mì-dhligheach
401
Gun ùghdarras - Comharra API neo-dhligheach no a dhìth
402
Pàigheadh a dhìth - Creideasan gu leòr
Faigh Mion-fhiosrachadh an Frithealaiche
Faigh fiosrachadh mionaideach mu fhrithealaiche sònraichte.
Paramadairean na Slighe
Paramadair
Seòrsa
Riatanach
Tuairisgeul
server_id
slàn-shluaigh
Tha
ID frithealaiche sònraichte
Eisimpleir Iarrtais
curl -X GET "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Copy
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())
Copy
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);
Copy
Eisimpleir Freagairt
{
"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"
}
Còdan Inbhe Freagairt
200
Chaidh mion-fhiosrachadh an fhrithealaiche fhaighinn air ais gu soirbheachail
401
Gun ùghdarras - Comharra API neo-dhligheach no a dhìth
404
Cha deach a lorg - Chan eil am frithealaiche ann
Frithealaiche Ùrachaidh
Ùraich rèiteachadh an fhrithealaiche. Tha a h-uile raon riatanach.
Paramadairean na Slighe
Parameter
Type
Required
Description
server_id
integer
Yes
ID frithealaiche sònraichte
Paramadairean Corp Iarrtais
Paramadair
Seòrsa
Riatanach
Tuairisgeul
name
sreang
Tha
Ainm an fhrithealaiche
hostname
sreang
Tha
Ainm-aoigheachd an fhrithealaiche (FQDN)
backups_enabled
boolean
Tha
Cuir an comas/dì-chomasaich cùl-taicean fèin-ghluasadach
Eisimpleir Iarrtais
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
}'
Copy
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())
Copy
Còdan Inbhe Freagairt
200
Chaidh an frithealaiche ùrachadh gu soirbheachail
400
Droch Iarrtas - Paramadairean mì-dhligheach
404
Cha deach a lorg - Chan eil am frithealaiche ann
Ùraich am frithealaiche gu ìre
Ùraich raointean sònraichte an fhrithealaiche. Cha tèid ach na raointean a chaidh a thoirt seachad ùrachadh.
Eisimpleir Iarrtais
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"
}'
Copy
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())
Copy
Sguab às an fhrithealaiche
Sguab às frithealaiche gu buan. Chan urrainnear an gnìomh seo a thoirt air ais.
Eisimpleir Iarrtais
curl -X DELETE "https://admin.vps.org/api/v1/servers/12345/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Copy
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)
Copy
Còdan Inbhe Freagairt
204
Chaidh an frithealaiche a dhubhadh às gu soirbheachail
404
Cha deach a lorg - Chan eil am frithealaiche ann
Tòisich an Frithealaiche
Cuir cumhachd air frithealaiche a tha air stad.
Eisimpleir Iarrtais
curl -X POST "https://admin.vps.org/api/v1/servers/12345/start/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Copy
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())
Copy
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);
Copy
Eisimpleir Freagairt
{
"status": "success",
"message": "Server is starting",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "starting"
}
}
Còdan Inbhe Freagairt
200
Òrdugh tòiseachaidh frithealaiche air a chur gu soirbheachail
400
Droch Iarrtas - Tha am frithealaiche a’ ruith mu thràth
404
Cha deach a lorg - Chan eil am frithealaiche ann
Stad an Frithealaiche
Dùin sìos frithealaiche a tha a’ ruith gu grinn.
Eisimpleir Iarrtais
curl -X POST "https://admin.vps.org/api/v1/servers/12345/stop/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Copy
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())
Copy
Eisimpleir Freagairt
{
"status": "success",
"message": "Server is stopping",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "stopping"
}
}
Ath-thòisich an frithealaiche
Ath-thòisich frithealaiche a tha a’ ruith gu grinn.
Eisimpleir Iarrtais
curl -X POST "https://admin.vps.org/api/v1/servers/12345/reboot/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Copy
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())
Copy
Eisimpleir Freagairt
{
"status": "success",
"message": "Server is rebooting",
"server": {
"id": 12345,
"name": "web-server-01",
"status": "rebooting"
}
}
Còdan Inbhe Freagairt
200
Òrdugh ath-thòiseachadh frithealaiche air a chur gu soirbheachail
400
Droch Iarrtas - Chan eil am frithealaiche a’ ruith
404
Cha deach a lorg - Chan eil am frithealaiche ann