VPS.org API

REST API Magwaro

API yeSnapshots

Ronga mapikicha eseva kuti ugadzirise nekukurumidza. Mifananidzo inotora mamiriro ese eseva yako.

Magumo 4 endpoints
Nzira Yekutanga /api/v1/snapshots
Tora /api/v1/snapshots/

Rondedzera Mifananidzo Yese

Tora runyorwa rwemifananidzo yese iri pamaseva ako.

Maparamita emibvunzo

Paramita Rudzi Zvinodiwa Tsananguro
server_id integer Aihwa Sefa mapikicha ne server ID

Muenzaniso weChikumbiro

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

Muenzaniso weMhinduro

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

Makodhi eMamiriro eMhinduro

200 Yabudirira kutora snapshot list
401 Hazvibvumirwi - Chiratidzo chekusimbisa chisiri chechokwadi kana kuti chiripo
POST /api/v1/snapshots/

Gadzira Mufananidzo Wepikicha

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

Kumbira Maparamita Emuviri

Paramita Rudzi Zvinodiwa Tsananguro
server_id integer Ehe ID yeseva yekutora mufananidzo
name string Ehe Zita remufananidzo (mavara emavara, ma hyphens, ma underscores)
description string Aihwa Tsananguro yesarudzo yemufananidzo

Muenzaniso weChikumbiro

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

Muenzaniso weMhinduro

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

Makodhi eMamiriro eMhinduro

201 Kugadzirwa kwemifananidzo kwakatanga kubudirira
400 Bad Request - Invalid parameters or snapshot limit reached
401 Hazvibvumirwi - Chiratidzo chekusimbisa chisiri chechokwadi kana kuti chiripo
404 Not Found - Server does not exist
Cherechedza: 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.
POST /api/v1/snapshots/{snapshot_id}/restore/

Dzorera kubva paSnapshot

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

MaParameter eNzira

Paramita Rudzi Zvinodiwa Tsananguro
snapshot_id integer Ehe ID yemufananidzo wakasiyana

Muenzaniso weChikumbiro

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

Muenzaniso weMhinduro

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

Makodhi eMamiriro eMhinduro

200 Kugadzirisa kwakatanga zvinobudirira
400 Bad Request - Server is not in a valid state for restoration
401 Hazvibvumirwi - Chiratidzo chekusimbisa chisiri chechokwadi kana kuti chiripo
404 Hazviwanikwe - Snapshot haipo
Yambiro: 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.
DZIMA /api/v1/snapshots/{snapshot_id}/

Bvisa Mufananidzo Wepikicha

Bvisa mufananidzo zvachose. Chiito ichi hachigone kudzoserwa shure.

MaParameter eNzira

Paramita Rudzi Zvinodiwa Tsananguro
snapshot_id integer Ehe ID yemufananidzo wakasiyana

Muenzaniso weChikumbiro

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)

Makodhi eMamiriro eMhinduro

204 Mufananidzo weSnapshot wakabudirira kubviswa
401 Hazvibvumirwi - Chiratidzo chekusimbisa chisiri chechokwadi kana kuti chiripo
404 Hazviwanikwe - Snapshot haipo

Snapshots vs Backups

Understanding when to use snapshots versus backups:

API yeSnapshots

  • Chinangwa: Quick point-in-time recovery
  • Kumhanya: Faster to create and restore (3-15 min)
  • Nyaya Yekushandisa: Before risky operations (updates, config changes)
  • Kuchengetera: Stored on same infrastructure
  • Muganho: 5 snapshots per server
  • Zvakanakira: Short-term rollback capability

API yeBackups

  • Chinangwa: Long-term data protection
  • Kumhanya: Slower to create and restore (varies)
  • Nyaya Yekushandisa: Regular automated data protection
  • Kuchengetera: Separate backup storage
  • Muganho: 10 manual + automatic backups
  • Zvakanakira: Disaster recovery and compliance

Best Practices