ټول سرورونه لیست کړئ
په خپل حساب کې د ټولو سرورونو لیست ترلاسه کړئ.
د پوښتنې پیرامیټرې
| پیرامیټر |
ډول |
اړین دی |
تفصیل |
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 نښه ناسمه یا ورکه ده |
نوی سرور جوړ کړئ
د ټاکل شوي ترتیب سره یو نوی 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 |
تادیه اړینه ده - کافي کریډیټونه نشته |
د سرور توضیحات ترلاسه کړئ
د یو ځانګړي سرور په اړه مفصل معلومات ترلاسه کړئ.
د لارې پیرامیټرې
| پیرامیټر |
ډول |
اړین دی |
تفصیل |
server_id |
عدد |
هو |
د سرور ځانګړی ID |
د غوښتنې بېلګه
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 |
ونه موندل شو - سرور شتون نلري |
سرور تازه کړئ
د سرور ترتیب تازه کړئ. ټولې برخې اړینې دي.
د لارې پیرامیټرې
| Parameter |
Type |
Required |
Description |
server_id |
integer |
Yes |
د سرور ځانګړی ID |
د بدن پیرامیټرو غوښتنه وکړئ
| پیرامیټر |
ډول |
اړین دی |
تفصیل |
name |
تار |
هو |
د سرور نوم |
hostname |
تار |
هو |
د سرور کوربه نوم (FQDN) |
backups_enabled |
بولین |
هو |
اتوماتیک بیک اپ فعال/غیر فعال کړئ |
د غوښتنې بېلګه
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 |
ونه موندل شو - سرور شتون نلري |
د سرور جزوي تازه کول
د سرور ځانګړي ساحې تازه کړئ. یوازې چمتو شوي ساحې به تازه شي.
د غوښتنې بېلګه
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())
سرور ړنګ کړئ
یو سرور په دایمي ډول ړنګ کړئ. دا عمل بیرته نشي راوستلی.
د غوښتنې بېلګه
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 |
ونه موندل شو - سرور شتون نلري |
سرور پیل کړئ
په بند شوي سرور باندې بریښنا.
د غوښتنې بېلګه
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 |
ونه موندل شو - سرور شتون نلري |
سرور ودروئ
په مهربانۍ سره یو روان سرور بند کړئ.
د غوښتنې بېلګه
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"
}
}
سرور بیا پیل کړئ
په مهربانۍ سره یو روان سرور بیا پیل کړئ.
د غوښتنې بېلګه
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 |
ونه موندل شو - سرور شتون نلري |