VPS.org API

Belgekirina REST API

API-ya hilanînê

Bi awayekî bernameyî kopiyên hilanînê yên serverê birêve bibin. Kopiyên hilanînê yên serverên xwe navnîş bikin, biafirînin, sererast bikin û jê bibin.

Xalên Dawî 3 endpoints
Riya bingehîn /api/v1/backups
STENDIN /api/v1/backups/

Hemû Kopiyên Piştrastkirî Bilîze Bike

Lîsteyek hemî kopiyên ewlehiyê li ser serverên xwe bistînin.

Parametreyên Lêpirsînê

Parametre Awa Pêwîst Terîf
server_id integer Na Kopiyên hilanînê li gorî nasnameya serverê fîltre bike
backup_type string Na Li gorî celebê parzûn bike: manual , automatic

Daxwaza Nimûne

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

Bersiva Mînakî

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

Kodên Rewşa Bersivê

200 Lîsteya hilanînê bi serkeftî hat vegerandin
401 Bêdestûr - Nîşana pejirandinê ya nederbasdar an jî winda
KOZ /api/v1/backups/

Backupa Destî Biafirîne

Kopiyek hilanînê ya destî ya serverekê biafirîne. Kopiyên hilanînê yên destî bixweber nayên hilanîn.

Parametreyên Laşê Daxwazê

Parametre Awa Pêwîst Terîf
server_id integer Erê Nasnameya serverê ji bo hilanînê
description string Na Ravekirina bijarte ji bo hilanînê

Daxwaza Nimûne

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

Bersiva Mînakî

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

Kodên Rewşa Bersivê

201 Afirandina paşvekişandinê bi serkeftî dest pê kir
400 Daxwaza Xirab - Parametreyên nederbasdar an daxwazek bi şêweya xelet
401 Bêdestûr - Nîşana pejirandinê ya nederbasdar an jî winda
404 Nehat Dîtin - Server tune ye
Not: Hûn dikarin herî zêde 10 kopiyên hilanînê yên destî ji bo her serverekê çêbikin. Kopiyên hilanînê yên otomatîk li gorî polîtîkaya hilanîna kopiyên hilanînê ya plana we têne parastin (bi gelemperî 7-30 roj).
JÊBIRIN /api/v1/backups/{backup_id}/

Jêbirina Kopiya Piştgiriyê

Ji bo her tim paşvekişandinê jê bibe. Ev çalakî nayê vegerandin.

Parametreyên Rêyê

Parametre Awa Pêwîst Terîf
backup_id integer Erê Nasnameya yekta ya hilanînê

Daxwaza Nimûne

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

Kodên Rewşa Bersivê

204 Kopiya hilanînê bi serkeftî hat jêbirin
401 Bêdestûr - Nîşana pejirandinê ya nederbasdar an jî winda
404 Nehat Dîtin - Pêvek tune ye
Gazî: Jêbirina kopiyek ewlehiyê (backup) mayînde ye û nayê vegerandin. Berî ku hûn jê bibin, piştrast bin ku hûn êdî hewceyê vê kopiyek ewlehiyê (backup) nînin.

Vegerandina ji Kopiyên Parastinê

Ji bo vegerandina serverekê ji kopiyekê, xala dawî ya vegerandina Servers API bikar bînin:

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

Ji bo agahdariya berfireh li ser sererastkirina serverê, binêre Belgekirina API-ya Serveran.

Rêbazên Herî Baş ên Piştgiriyê