VPS.org API

REST API ਡੌਕੂਮੈਂਟੇਸ਼ਨ

ਸਥਾਨ API

ਟਿਕਾਣੇ ਵੇਖੋ, ਜਿੱਥੇ ਤੁਸੀਂ VPS ਨੂੰ ਡਿਪੋਜ਼ਿਟ ਕਰ ਸਕਦੇ ਹੋ। ਜਦੋਂ ਸਰਵਰ ਬਣਾਓ ਤਾਂ ਟਿਕਾਣੇ ਦਾ id location_id ਵਾਂਗ ਦਿਓ।

ਅੰਤਮ ਬਿੰਦੂ 2 endpoints
ਬੇਸ ਪਾਥ /api/v1/locations
ਪ੍ਰਾਪਤ ਕਰੋ /api/v1/locations/

ਸਾਰੇ ਸਥਾਨਾਂ ਦੀ ਸੂਚੀ ਬਣਾਓ

ਸਭ ਉਪਲੱਬਧ ਡਾਟਾ ਸੈਂਟਰ ਟਿਕਾਣੇ, ਜਿੱਥੇ ਤੁਸੀਂ VPS ਸਰਵਰਾਂ ਨੂੰ ਡਿਸਪਲੇਅ ਕਰ ਸਕਦੇ ਹੋ, ਦੀ ਲਿਸਟ ਪ੍ਰਾਪਤ ਕਰੋ ।

ਉਦਾਹਰਨ ਬੇਨਤੀ

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

ਉਦਾਹਰਨ ਜਵਾਬ

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

ਜਵਾਬ ਖੇਤਰ

ਖੇਤਰ ਦੀ ਕਿਸਮ ਵੇਰਵਾ
id integer ਟਿਕਾਣਾ ਪਛਾਣਕਰਤਾ। ਸਰਵਰ ਬਣਾਉਣ ਸਮੇਂ ਇਸ ਨੂੰ location_id ਵਾਂਗ ਵਰਤੋਂ।
name string ਮਨੁੱਖੀ ਪੜ੍ਹਨਯੋਗ ਟਿਕਾਣਾ ਨਾਂ
country_name string ਟਿਕਾਣਾ ਦੇਸ਼ ਹੈ
country_code string ISO 3166- 1 ਅਲਫਾ-2 ਦੇਸ਼ ਕੋਡ, ਵੱਡੇ ਅੱਖਰ
is_active boolean ਕੀ ਟਿਕਾਣਾ ਨਵੇਂ ਸਰਵਰਾਂ ਨੂੰ ਸਵੀਕਾਰ ਕਰਦਾ ਹੈ

ਜਵਾਬ ਸਥਿਤੀ ਕੋਡ

200 ਸਥਾਨਾਂ ਦੀ ਸੂਚੀ ਸਫਲਤਾਪੂਰਵਕ ਪ੍ਰਾਪਤ ਕੀਤੀ ਗਈ
403 ਗੁੰਮ ਜਾਂ ਅਢੁੱਕਵਾਂ API ਟੋਕਨ ਹੈ, ਜਾਂ ਟੋਕਨ ਵਿੱਚ ਲੋੜੀਦੇ ਅਧਿਕਾਰ ਨਹੀਂ ਹਨ
ਪ੍ਰਾਪਤ ਕਰੋ /api/v1/locations/{id}/

ਟਿਕਾਣਾ ਲਵੋ

ਇੱਕ ਟਿਕਾਣਾ ਇਸ ਦੇ id ਨਾਲ ਲਵੋ । ਜਵਾਬ ਇੱਕ ਟਿਕਾਣਾ ਇਕਾਈ ਹੈ, ਜਿਸ ਵਿੱਚ ਉੱਤੇ ਦੇ ਖੇਤਰ ਹਨ ।

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
}

ਜਿੱਥੇ ਤੁਹਾਡੇ ਸਰਵਰ ਚੱਲ ਰਹੇ ਹਨ

ਹਰ VPS.org ਸਰਵਰ ਸਾਡੇ ਨਵੇਂ ਜਰਸੀ, USA ਟਿਕਾਣੇ ਉੱਤੇ ਚੱਲਦਾ ਹੈ, ਜੋ ਕਿ IPv4 ਅਤੇ IPv6 ਉੱਤੇ ਦੁਨੀਆ ਭਰ ਦੇ ਗਾਹਕਾਂ ਨੂੰ ਸੇਵਾ ਦਿੰਦਾ ਹੈ। id ਨੂੰ ਹਾਰਡਕੋਡ ਕਰਨ ਦੀ ਬਜਾਏ ਹਮੇਸ਼ਾ ਟਿਕਾਣੇ ਅੰਤ ਬਿੰਦੂ ਪੜ੍ਹੋ, ਤਾਂ ਕਿ ਜਦੋਂ ਉਹ ਸ਼ਾਮਲ ਕੀਤੇ ਜਾਣ ਤਾਂ ਤੁਹਾਡਾ ਇੰਟਰਫੇਸ ਨਵੇਂ ਟਿਕਾਣੇ ਲੱਭ ਲਵੇ।