List flavors matching volume requirements
curl --request POST \
--url https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"volumes": [
{
"attachment_tag": "root",
"boot_index": 0,
"image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1",
"name": "TestVM5 Ubuntu boot image",
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors"
payload = { "volumes": [
{
"attachment_tag": "root",
"boot_index": 0,
"image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1",
"name": "TestVM5 Ubuntu boot image",
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
volumes: [
{
attachment_tag: 'root',
boot_index: 0,
image_id: 'f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1',
name: 'TestVM5 Ubuntu boot image',
size: 10,
source: 'image',
type_name: 'ssd_hiiops'
}
]
})
};
fetch('https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors', 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/instances/{project_id}/{region_id}/available_flavors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'volumes' => [
[
'attachment_tag' => 'root',
'boot_index' => 0,
'image_id' => 'f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1',
'name' => 'TestVM5 Ubuntu boot image',
'size' => 10,
'source' => 'image',
'type_name' => 'ssd_hiiops'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors"
payload := strings.NewReader("{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"architecture": "x86_64",
"disabled": false,
"flavor_id": "g2-standard-32-64",
"flavor_name": "g2-standard-32-64",
"os_type": "linux",
"ram": 2048,
"vcpus": 1,
"capacity": 1,
"currency_code": "USD",
"hardware_description": {},
"price_per_hour": 1,
"price_per_month": 720,
"price_status": "show",
"reserved_capacity": 5
}
]
}Instances
List flavors matching volume requirements
List all flavors that are suitable for instance creation based on volume requirements.
POST
/
cloud
/
v1
/
instances
/
{project_id}
/
{region_id}
/
available_flavors
List flavors matching volume requirements
curl --request POST \
--url https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"volumes": [
{
"attachment_tag": "root",
"boot_index": 0,
"image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1",
"name": "TestVM5 Ubuntu boot image",
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors"
payload = { "volumes": [
{
"attachment_tag": "root",
"boot_index": 0,
"image_id": "f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1",
"name": "TestVM5 Ubuntu boot image",
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
volumes: [
{
attachment_tag: 'root',
boot_index: 0,
image_id: 'f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1',
name: 'TestVM5 Ubuntu boot image',
size: 10,
source: 'image',
type_name: 'ssd_hiiops'
}
]
})
};
fetch('https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors', 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/instances/{project_id}/{region_id}/available_flavors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'volumes' => [
[
'attachment_tag' => 'root',
'boot_index' => 0,
'image_id' => 'f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1',
'name' => 'TestVM5 Ubuntu boot image',
'size' => 10,
'source' => 'image',
'type_name' => 'ssd_hiiops'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors"
payload := strings.NewReader("{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/available_flavors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"volumes\": [\n {\n \"attachment_tag\": \"root\",\n \"boot_index\": 0,\n \"image_id\": \"f01fd9a0-9548-48ba-82dc-a8c8b2d6f2f1\",\n \"name\": \"TestVM5 Ubuntu boot image\",\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"architecture": "x86_64",
"disabled": false,
"flavor_id": "g2-standard-32-64",
"flavor_name": "g2-standard-32-64",
"os_type": "linux",
"ram": 2048,
"vcpus": 1,
"capacity": 1,
"currency_code": "USD",
"hardware_description": {},
"price_per_hour": 1,
"price_per_month": 720,
"price_status": "show",
"reserved_capacity": 5
}
]
}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
Set to true if flavor listing should include flavor prices
Body
application/json
CreateInstanceVolumeList schema
Volumes details. Non-important info such as names may be omitted.
Show child attributes
Show child attributes
Was this page helpful?
⌘I