VPS.org API

REST API ਦਸਤਾਵੇਜ਼ੀਕਰਨ

ਬੈਕਅੱਪ API

ਸਰਵਰ ਬੈਕਅੱਪਾਂ ਨੂੰ ਪ੍ਰੋਗਰਾਮੇਟਿਕ ਤੌਰ 'ਤੇ ਪ੍ਰਬੰਧਿਤ ਕਰੋ। ਆਪਣੇ ਸਰਵਰਾਂ ਲਈ ਬੈਕਅੱਪਾਂ ਦੀ ਸੂਚੀ ਬਣਾਓ, ਬਣਾਓ, ਰੀਸਟੋਰ ਕਰੋ ਅਤੇ ਮਿਟਾਓ।

ਅੰਤਮ ਬਿੰਦੂ 3 endpoints
ਬੇਸ ਪਾਥ /api/v1/backups
ਪ੍ਰਾਪਤ ਕਰੋ /api/v1/backups/

ਸਾਰੇ ਬੈਕਅੱਪਾਂ ਦੀ ਸੂਚੀ ਬਣਾਓ

ਆਪਣੇ ਸਰਵਰਾਂ 'ਤੇ ਸਾਰੇ ਬੈਕਅੱਪਾਂ ਦੀ ਸੂਚੀ ਪ੍ਰਾਪਤ ਕਰੋ।

ਪੁੱਛਗਿੱਛ ਪੈਰਾਮੀਟਰ

ਪੈਰਾਮੀਟਰ ਦੀ ਕਿਸਮ ਲੋੜੀਂਦਾ ਵੇਰਵਾ
server_id integer ਨਹੀਂ ਸਰਵਰ ਆਈਡੀ ਦੁਆਰਾ ਬੈਕਅੱਪ ਫਿਲਟਰ ਕਰੋ
backup_type string ਨਹੀਂ ਕਿਸਮ ਅਨੁਸਾਰ ਫਿਲਟਰ ਕਰੋ: manual , automatic

ਉਦਾਹਰਨ ਬੇਨਤੀ

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

ਉਦਾਹਰਨ ਜਵਾਬ

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

ਜਵਾਬ ਸਥਿਤੀ ਕੋਡ

200 ਬੈਕਅੱਪ ਸੂਚੀ ਸਫਲਤਾਪੂਰਵਕ ਪ੍ਰਾਪਤ ਕੀਤੀ ਗਈ
401 ਅਣਅਧਿਕਾਰਤ - ਅਵੈਧ ਜਾਂ ਗੁੰਮ ਪ੍ਰਮਾਣੀਕਰਨ ਟੋਕਨ
ਪੋਸਟ /api/v1/backups/

ਮੈਨੁਅਲ ਬੈਕਅੱਪ ਬਣਾਓ

ਸਰਵਰ ਦਾ ਮੈਨੂਅਲ ਬੈਕਅੱਪ ਬਣਾਓ। ਮੈਨੂਅਲ ਬੈਕਅੱਪ ਆਪਣੇ ਆਪ ਖਤਮ ਨਹੀਂ ਹੁੰਦੇ।

ਬਾਡੀ ਪੈਰਾਮੀਟਰ ਦੀ ਬੇਨਤੀ ਕਰੋ

ਪੈਰਾਮੀਟਰ ਦੀ ਕਿਸਮ ਲੋੜੀਂਦਾ ਵੇਰਵਾ
server_id integer ਹਾਂ ਬੈਕਅੱਪ ਲੈਣ ਲਈ ਸਰਵਰ ਦਾ ID
description string ਨਹੀਂ ਬੈਕਅੱਪ ਲਈ ਵਿਕਲਪਿਕ ਵੇਰਵਾ

ਉਦਾਹਰਨ ਬੇਨਤੀ

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

ਉਦਾਹਰਨ ਜਵਾਬ

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

ਜਵਾਬ ਸਥਿਤੀ ਕੋਡ

201 ਬੈਕਅੱਪ ਬਣਾਉਣਾ ਸਫਲਤਾਪੂਰਵਕ ਸ਼ੁਰੂ ਹੋਇਆ
400 ਗਲਤ ਬੇਨਤੀ - ਅਵੈਧ ਪੈਰਾਮੀਟਰ ਜਾਂ ਨੁਕਸਦਾਰ ਬੇਨਤੀ
401 ਅਣਅਧਿਕਾਰਤ - ਅਵੈਧ ਜਾਂ ਗੁੰਮ ਪ੍ਰਮਾਣੀਕਰਨ ਟੋਕਨ
404 ਨਹੀਂ ਮਿਲਿਆ - ਸਰਵਰ ਮੌਜੂਦ ਨਹੀਂ ਹੈ।
ਨੋਟ: ਤੁਸੀਂ ਪ੍ਰਤੀ ਸਰਵਰ ਵੱਧ ਤੋਂ ਵੱਧ 10 ਮੈਨੂਅਲ ਬੈਕਅੱਪ ਲੈ ਸਕਦੇ ਹੋ। ਆਟੋਮੈਟਿਕ ਬੈਕਅੱਪ ਤੁਹਾਡੀ ਯੋਜਨਾ ਦੀ ਬੈਕਅੱਪ ਧਾਰਨ ਨੀਤੀ (ਆਮ ਤੌਰ 'ਤੇ 7-30 ਦਿਨ) ਦੇ ਆਧਾਰ 'ਤੇ ਰੱਖੇ ਜਾਂਦੇ ਹਨ।
ਮਿਟਾਓ /api/v1/backups/{backup_id}/

ਬੈਕਅੱਪ ਮਿਟਾਓ

ਬੈਕਅੱਪ ਨੂੰ ਸਥਾਈ ਤੌਰ 'ਤੇ ਮਿਟਾਓ। ਇਸ ਕਾਰਵਾਈ ਨੂੰ ਅਣਕੀਤਾ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ।

ਮਾਰਗ ਪੈਰਾਮੀਟਰ

ਪੈਰਾਮੀਟਰ ਦੀ ਕਿਸਮ ਲੋੜੀਂਦਾ ਵੇਰਵਾ
backup_id integer ਹਾਂ ਵਿਲੱਖਣ ਬੈਕਅੱਪ ਆਈਡੀ

ਉਦਾਹਰਨ ਬੇਨਤੀ

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

ਜਵਾਬ ਸਥਿਤੀ ਕੋਡ

204 ਬੈਕਅੱਪ ਸਫਲਤਾਪੂਰਵਕ ਮਿਟਾਇਆ ਗਿਆ
401 ਅਣਅਧਿਕਾਰਤ - ਅਵੈਧ ਜਾਂ ਗੁੰਮ ਪ੍ਰਮਾਣੀਕਰਨ ਟੋਕਨ
404 ਨਹੀਂ ਮਿਲਿਆ - ਬੈਕਅੱਪ ਮੌਜੂਦ ਨਹੀਂ ਹੈ
ਚੇਤਾਵਨੀ: ਬੈਕਅੱਪ ਨੂੰ ਮਿਟਾਉਣਾ ਸਥਾਈ ਹੈ ਅਤੇ ਇਸਨੂੰ ਵਾਪਸ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਦਾ। ਇਸਨੂੰ ਮਿਟਾਉਣ ਤੋਂ ਪਹਿਲਾਂ ਯਕੀਨੀ ਬਣਾਓ ਕਿ ਤੁਹਾਨੂੰ ਹੁਣ ਇਸ ਬੈਕਅੱਪ ਦੀ ਲੋੜ ਨਹੀਂ ਹੈ।

ਬੈਕਅੱਪ ਤੋਂ ਰੀਸਟੋਰ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ

ਬੈਕਅੱਪ ਤੋਂ ਸਰਵਰ ਨੂੰ ਰੀਸਟੋਰ ਕਰਨ ਲਈ, ਸਰਵਰ API ਰੀਸਟੋਰ ਐਂਡਪੁਆਇੰਟ ਦੀ ਵਰਤੋਂ ਕਰੋ:

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

ਸਰਵਰ ਬਹਾਲੀ ਬਾਰੇ ਵਿਸਤ੍ਰਿਤ ਜਾਣਕਾਰੀ ਲਈ, ਵੇਖੋ ਸਰਵਰ API ਦਸਤਾਵੇਜ਼.

ਬੈਕਅੱਪ ਵਧੀਆ ਅਭਿਆਸ