VPS.org API

REST API દસ્તાવેજીકરણ

બેકઅપ્સ API

સર્વર બેકઅપ્સ પ્રોગ્રામેટિકલી મેનેજ કરો. તમારા સર્વર્સ માટે બેકઅપ્સની યાદી બનાવો, બનાવો, પુનઃસ્થાપિત કરો અને કાઢી નાખો.

અંતિમ બિંદુઓ 3 endpoints
બેઝ પાથ /api/v1/backups
મેળવો /api/v1/backups/

બધા બેકઅપ્સની યાદી બનાવો

તમારા સર્વર પરના બધા બેકઅપ્સની યાદી મેળવો.

ક્વેરી પરિમાણો

પરિમાણ પ્રકાર જરૂરી વર્ણન
server_id integer ના સર્વર ID દ્વારા બેકઅપ ફિલ્ટર કરો
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 હા યુનિક બેકઅપ ID

ઉદાહરણ વિનંતી

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 દસ્તાવેજીકરણ.

બેકઅપ શ્રેષ્ઠ પ્રથાઓ