VPS.org API

REST API Xuquuqda

Goobaha API

Liiska meelaha aad ku soo bandhigi kartaa VPS. Pass id meel sida location_id marka aad abuurto server.

Dhammaadka 2 endpoints
Waddo Saldhig ah /api/v1/locations
HEL /api/v1/locations/

Liiska Dhammaan Goobaha

Soo celinta liiska dhammaan goobaha datacenter ee jira oo aad ku isticmaali karto VPS servers.

Codsi Tusaale ah

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

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

response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/locations/', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const locations = await response.json();
console.log(locations);
$ch = curl_init('https://admin.vps.org/api/v1/locations/');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$locations = json_decode($response, true);
curl_close($ch);

Jawaabta Tusaale

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "New Jersey",
      "country_name": "United States",
      "country_code": "US",
      "is_active": true
    }
  ]
}

Goobaha Jawaabta

Isku-darka Nooca Tilmaamaha
id integer Magaca goobta. U isticmaal sida location_id marka aad abuurto server.
name string Magaca meelaha la akhrin karo
country_name string Dalka meesha ku taal
country_code string ISO 3166-1 alpha-2 koodka waddanka, xarfo waaweyn
is_active boolean Haddii goobta ay aqbali doonto servers cusub

Koodhadhka Xaaladda Jawaab celinta

200 Liiska goobaha si guul leh ayaa loo soo ceshaday
403 Xiran ama aan sharci ahayn API token, ama token ka maqan oggolaanshaha loo baahan yahay
HEL /api/v1/locations/{id}/

Hesho meel

Ka soo kabsado meel kaliya by id-kiisa. jawaabta waa mid meel wax la goobaha kor ku xusan.

curl -X GET "https://admin.vps.org/api/v1/locations/1/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "id": 1,
  "name": "New Jersey",
  "country_name": "United States",
  "country_code": "US",
  "is_active": true
}

Meel ay ku socdaan server-yadaada

Server kasta VPS.org hadda socda in New Jersey, USA goobta, oo ka adeega macaamiisha adduunka oo dhan IPv4 iyo IPv6. Mar kasta akhri goobaha endpoint ka badan hardcoding id, sidaas darteed integration aad u qaado goobaha cusub marka ay la daray.