VPS.org API

Doiciméadú API REST

API Cúltacaí

Bainistigh cúltacaí freastalaí go ríomhchláraitheach. Liostaigh, cruthaigh, athchóirigh agus scrios cúltacaí do do fhreastalaithe.

Críochphointí 3 endpoints
Cosán Bonn /api/v1/backups
FAIGH /api/v1/backups/

Liostaigh na Cúltaca Uile

Aisghabh liosta de na cúltacaí go léir ar fud do fhreastalaithe.

Paraiméadair Iarratais

Paraiméadar Cineál Riachtanach Cur síos
server_id integer Níl Scag cúltacaí de réir ID freastalaí
backup_type string Níl Scag de réir cineáil: manual , automatic

Iarratas Samplach

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

Freagra Samplach

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

Cóid Stádas Freagartha

200 Aisghabhadh an liosta cúltaca go rathúil
401 Neamhúdaraithe - Comhartha fíordheimhnithe neamhbhailí nó ar iarraidh
POST /api/v1/backups/

Cruthaigh Cúltaca Láimhe

Cruthaigh cúltaca láimhe den fhreastalaí. Ní théann cúltacaí láimhe in éag go huathoibríoch.

Paraiméadair Chomhlacht an Iarratais

Paraiméadar Cineál Riachtanach Cur síos
server_id integer ID an fhreastalaí le cúltaca
description string Níl Cur síos roghnach don chúltaca

Iarratas Samplach

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

Freagra Samplach

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

Cóid Stádas Freagartha

201 Cuireadh tús le cruthú cúltaca go rathúil
400 Iarratas Droch - Paraiméadair neamhbhailí nó iarratas mífhoirmithe
401 Neamhúdaraithe - Comhartha fíordheimhnithe neamhbhailí nó ar iarraidh
404 Níor aimsíodh é - Níl an freastalaí ann
Nóta: Is féidir leat uasmhéid de 10 gcúltaca láimhe a bheith agat in aghaidh an fhreastalaí. Coinnítear cúltacaí uathoibríocha bunaithe ar pholasaí coinneála cúltaca do phlean (7-30 lá de ghnáth).
SCRÍOS /api/v1/backups/{backup_id}/

Scrios Cúltaca

Scrios cúltaca go buan. Ní féidir an gníomh seo a chealú.

Paraiméadair na gCosán

Paraiméadar Cineál Riachtanach Cur síos
backup_id integer ID cúltaca uathúil

Iarratas Samplach

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

Cóid Stádas Freagartha

204 Scriosadh an cúltaca go rathúil
401 Neamhúdaraithe - Comhartha fíordheimhnithe neamhbhailí nó ar iarraidh
404 Níor aimsíodh é - Níl an cúltaca ann
Rabhadh: Is buan an rud é cúltaca a scriosadh agus ní féidir é a chealú. Déan cinnte nach bhfuil an cúltaca seo ag teastáil uait a thuilleadh sula scriosann tú é.

Ag Athchóiriú ó Chúltacaí

Chun freastalaí a athchóiriú ó chúltaca, bain úsáid as críochphointe athchóirithe API na bhFreastalaithe :

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

Chun eolas mionsonraithe a fháil faoi athchóiriú freastalaí, féach ar Doiciméadú API freastalaithe.

Cleachtais is Fearr maidir le Cúltaca