VPS.org API

REST API ஆவணம்

ஸ்னாப்ஷாட்ஸ் API

விரைவான புள்ளி-நேர மீட்டெடுப்பிற்காக சேவையக ஸ்னாப்ஷாட்களை நிர்வகிக்கவும். ஸ்னாப்ஷாட்கள் உங்கள் சேவையகத்தின் முழுமையான நிலையைப் படம்பிடிக்கும்.

முனைப்புள்ளிகள் 4 endpoints
அடிப்படை பாதை /api/v1/snapshots
பெறு /api/v1/snapshots/

அனைத்து ஸ்னாப்ஷாட்களையும் பட்டியலிடுங்கள்

உங்கள் சேவையகங்களில் உள்ள அனைத்து ஸ்னாப்ஷாட்களின் பட்டியலை மீட்டெடுக்கவும்.

வினவல் அளவுருக்கள்

அளவுரு வகை அவசியம் விளக்கம்
server_id integer இல்லை சர்வர் ஐடி மூலம் ஸ்னாப்ஷாட்களை வடிகட்டவும்

மாதிரி கோரிக்கை

cURL
Python
JavaScript
curl -X GET "https://admin.vps.org/api/v1/snapshots/?server_id=12345" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

url = "https://admin.vps.org/api/v1/snapshots/"
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/snapshots/?server_id=12345', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const snapshots = await response.json();
console.log(snapshots);

எடுத்துக்காட்டு பதில்

{
  "count": 2,
  "results": [
    {
      "id": 801,
      "server": {
        "id": 12345,
        "name": "web-server-01"
      },
      "name": "pre-migration-snapshot",
      "status": "completed",
      "size_mb": 5120,
      "created_at": "2025-01-15T18:30:00Z",
      "description": "Before major migration"
    },
    {
      "id": 798,
      "server": {
        "id": 12345,
        "name": "web-server-01"
      },
      "name": "weekly-snapshot-2025-01-08",
      "status": "completed",
      "size_mb": 4856,
      "created_at": "2025-01-08T12:00:00Z",
      "description": "Weekly snapshot"
    }
  ]
}

பதில் நிலை குறியீடுகள்

200 ஸ்னாப்ஷாட் பட்டியல் வெற்றிகரமாக மீட்டெடுக்கப்பட்டது.
401 அங்கீகரிக்கப்படாதது - தவறான அங்கீகார டோக்கன் அல்லது காணவில்லை.
அஞ்சல் /api/v1/snapshots/

ஸ்னாப்ஷாட்டை உருவாக்கு

Create a snapshot of a server's current state. Snapshots are point-in-time copies of the entire server.

கோரிக்கை உடல் அளவுருக்கள்

அளவுரு வகை அவசியம் விளக்கம்
server_id integer ஆம் ஸ்னாப்ஷாட் எடுக்க வேண்டிய சர்வரின் ஐடி
name string ஆம் ஸ்னாப்ஷாட்டின் பெயர் (எண்ணெழுத்து, ஹைபன்கள், அடிக்கோடுகள்)
description string இல்லை ஸ்னாப்ஷாட்டிற்கான விருப்ப விளக்கம்

மாதிரி கோரிக்கை

cURL
Python
JavaScript
curl -X POST "https://admin.vps.org/api/v1/snapshots/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "server_id": 12345,
    "name": "before-update-snapshot",
    "description": "Snapshot before system update"
  }'
import requests

url = "https://admin.vps.org/api/v1/snapshots/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "server_id": 12345,
    "name": "before-update-snapshot",
    "description": "Snapshot before system update"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/snapshots/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    server_id: 12345,
    name: 'before-update-snapshot',
    description: 'Snapshot before system update'
  })
});

const snapshot = await response.json();
console.log(snapshot);

எடுத்துக்காட்டு பதில்

{
  "id": 802,
  "server": {
    "id": 12345,
    "name": "web-server-01"
  },
  "name": "before-update-snapshot",
  "status": "in_progress",
  "size_mb": null,
  "created_at": "2025-01-16T16:15:00Z",
  "description": "Snapshot before system update",
  "message": "Snapshot is being created. This may take 3-10 minutes depending on server size."
}

பதில் நிலை குறியீடுகள்

201 ஸ்னாப்ஷாட் உருவாக்கம் வெற்றிகரமாக தொடங்கப்பட்டது.
400 Bad Request - Invalid parameters or snapshot limit reached
401 அங்கீகரிக்கப்படாதது - தவறான அங்கீகார டோக்கன் அல்லது காணவில்லை.
404 Not Found - Server does not exist
குறிப்பு: You can have a maximum of 5 snapshots per server. Creating a snapshot while the server is running may result in filesystem inconsistencies. For best results, stop the server before creating a snapshot.
அஞ்சல் /api/v1/snapshots/{snapshot_id}/restore/

ஸ்னாப்ஷாட்டிலிருந்து மீட்டமை

Restore a server to the state captured in a snapshot. This will overwrite all current data on the server.

பாதை அளவுருக்கள்

அளவுரு வகை அவசியம் விளக்கம்
snapshot_id integer ஆம் தனித்துவமான ஸ்னாப்ஷாட் ஐடி

மாதிரி கோரிக்கை

cURL
Python
JavaScript
curl -X POST "https://admin.vps.org/api/v1/snapshots/801/restore/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

snapshot_id = 801
url = f"https://admin.vps.org/api/v1/snapshots/{snapshot_id}/restore/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)
print(response.json())
const snapshotId = 801;
const response = await fetch(`https://admin.vps.org/api/v1/snapshots/${snapshotId}/restore/`, {
  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 being restored from snapshot. This may take 5-15 minutes.",
  "snapshot": {
    "id": 801,
    "name": "pre-migration-snapshot",
    "created_at": "2025-01-15T18:30:00Z"
  },
  "server": {
    "id": 12345,
    "name": "web-server-01",
    "status": "restoring"
  }
}

பதில் நிலை குறியீடுகள்

200 மீட்டெடுப்பு வெற்றிகரமாக தொடங்கப்பட்டது
400 Bad Request - Server is not in a valid state for restoration
401 அங்கீகரிக்கப்படாதது - தவறான அங்கீகார டோக்கன் அல்லது காணவில்லை.
404 கிடைக்கவில்லை - ஸ்னாப்ஷாட் இல்லை.
எச்சரிக்கை: Restoring from a snapshot will overwrite all current data on the server. This action cannot be undone. The server will be automatically stopped before restoration begins.
நீக்கு /api/v1/snapshots/{snapshot_id}/

ஸ்னாப்ஷாட்டை நீக்கு

ஒரு ஸ்னாப்ஷாட்டை நிரந்தரமாக நீக்கவும். இந்தச் செயலைச் செயல்தவிர்க்க முடியாது.

பாதை அளவுருக்கள்

அளவுரு வகை அவசியம் விளக்கம்
snapshot_id integer ஆம் தனித்துவமான ஸ்னாப்ஷாட் ஐடி

மாதிரி கோரிக்கை

cURL
Python
curl -X DELETE "https://admin.vps.org/api/v1/snapshots/801/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
import requests

snapshot_id = 801
url = f"https://admin.vps.org/api/v1/snapshots/{snapshot_id}/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.delete(url, headers=headers)
print(response.status_code)

பதில் நிலை குறியீடுகள்

204 ஸ்னாப்ஷாட் வெற்றிகரமாக நீக்கப்பட்டது
401 அங்கீகரிக்கப்படாதது - தவறான அங்கீகார டோக்கன் அல்லது காணவில்லை.
404 கிடைக்கவில்லை - ஸ்னாப்ஷாட் இல்லை.

Snapshots vs Backups

Understanding when to use snapshots versus backups:

ஸ்னாப்ஷாட்ஸ் API

  • நோக்கம்: Quick point-in-time recovery
  • வேகம்: Faster to create and restore (3-15 min)
  • வழக்கு பயன்படுத்தவும்: Before risky operations (updates, config changes)
  • சேமிப்பு: Stored on same infrastructure
  • வரம்பு: 5 snapshots per server
  • சிறந்தது: Short-term rollback capability

காப்புப்பிரதிகள் API

  • நோக்கம்: Long-term data protection
  • வேகம்: Slower to create and restore (varies)
  • வழக்கு பயன்படுத்தவும்: Regular automated data protection
  • சேமிப்பு: Separate backup storage
  • வரம்பு: 10 manual + automatic backups
  • சிறந்தது: Disaster recovery and compliance

Best Practices