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 અલ્ફા-૨ દેશ કોડ, મોટા અક્ષરો
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 ને હાર્ડકોડીંગ કરતા સ્થળો અંતબિંદુને વાંચો, તેથી તમારું સંકલન નવી જગ્યાઓ ઉઠાવે છે જ્યારે તેઓ ઉમેરાય છે.