Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
page = client.cloud.regions.list()
page = page.results[0]
print(page.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Cloud.Regions.List(context.TODO(), cloud.RegionListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/regions \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/regions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/regions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/regions")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/regions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"access_level": "core",
"available_volume_types": [
"standard",
"ssd_hiiops",
"cold"
],
"coordinates": {
"latitude": 41.40338,
"longitude": 2.17403
},
"country": "LU",
"created_at": "2019-12-31T23:59:59",
"created_on": "2019-12-31T23:59:59",
"display_name": "Luxembourg",
"endpoint_type": "public",
"external_network_id": "c843c3e6-ef4d-4b92-8db2-e16ac05c5650",
"file_share_types": [
"standard",
"vast"
],
"has_ai": true,
"has_ai_gpu": true,
"has_baremetal": false,
"has_basic_vm": false,
"has_dbaas": false,
"has_ddos": true,
"has_k8s": true,
"has_kvm": true,
"has_sfs": false,
"id": 1,
"keystone_id": 1,
"keystone_name": "ED-9",
"metrics_database_id": 1,
"slug": "luxembourg-1",
"state": "NEW",
"task_id": null,
"vlan_physical_network": "br-ex",
"zone": "EMEA",
"ddos_endpoint_id": 3
}
]
}Regions
List regions
GET
/
cloud
/
v1
/
regions
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
page = client.cloud.regions.list()
page = page.results[0]
print(page.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Cloud.Regions.List(context.TODO(), cloud.RegionListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/regions \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/regions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/regions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/regions")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/regions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"access_level": "core",
"available_volume_types": [
"standard",
"ssd_hiiops",
"cold"
],
"coordinates": {
"latitude": 41.40338,
"longitude": 2.17403
},
"country": "LU",
"created_at": "2019-12-31T23:59:59",
"created_on": "2019-12-31T23:59:59",
"display_name": "Luxembourg",
"endpoint_type": "public",
"external_network_id": "c843c3e6-ef4d-4b92-8db2-e16ac05c5650",
"file_share_types": [
"standard",
"vast"
],
"has_ai": true,
"has_ai_gpu": true,
"has_baremetal": false,
"has_basic_vm": false,
"has_dbaas": false,
"has_ddos": true,
"has_k8s": true,
"has_kvm": true,
"has_sfs": false,
"id": 1,
"keystone_id": 1,
"keystone_name": "ED-9",
"metrics_database_id": 1,
"slug": "luxembourg-1",
"state": "NEW",
"task_id": null,
"vlan_physical_network": "br-ex",
"zone": "EMEA",
"ddos_endpoint_id": 3
}
]
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Query Parameters
Filter regions by display name. Case-insensitive exact match.
Example:
"Luxembourg"
Limit the number of returned regions. Falls back to default of 100 if not specified. Limited by max limit value of 1000
Required range:
x <= 1000Example:
100
Offset value is used to exclude the first set of records from the result
Required range:
x >= 0Example:
0
Order by field and direction.
Available options:
created_at.asc, created_at.desc, display_name.asc, display_name.desc Example:
"created_at.desc"
If defined then return only regions that support given product.
Available options:
containers, inference Example:
"inference"
If true, null available_volume_type is replaced with a list of available volume types.
Example:
false
Was this page helpful?