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.volume_snapshots.list(
project_id=1,
region_id=1,
)
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.VolumeSnapshots.List(context.TODO(), cloud.VolumeSnapshotListParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id}', 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/snapshots/{project_id}/{region_id}",
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/snapshots/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id}")
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": [
{
"created_at": "2019-05-29T05:32:41+0000",
"creator_task_id": "2358e3b1-5c42-4705-8950-6ddcfc19c3bd",
"description": "Snapshot description",
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"name": "my-snapshot",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"size": 20,
"status": "available",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"task_id": null,
"updated_at": "2019-05-29T05:39:20+0000",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227"
}
]
}Snapshots
List snapshots
List all volume snapshots in the specified project and region. Results can be filtered by volume, instance, schedule, or lifecycle policy.
GET
/
cloud
/
v1
/
snapshots
/
{project_id}
/
{region_id}
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.volume_snapshots.list(
project_id=1,
region_id=1,
)
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.VolumeSnapshots.List(context.TODO(), cloud.VolumeSnapshotListParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id}', 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/snapshots/{project_id}/{region_id}",
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/snapshots/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/snapshots/{project_id}/{region_id}")
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": [
{
"created_at": "2019-05-29T05:32:41+0000",
"creator_task_id": "2358e3b1-5c42-4705-8950-6ddcfc19c3bd",
"description": "Snapshot description",
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"name": "my-snapshot",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"size": 20,
"status": "available",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"task_id": null,
"updated_at": "2019-05-29T05:39:20+0000",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227"
}
]
}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
Path Parameters
Project ID
Example:
1
Region ID
Example:
1
Query Parameters
Optional. Filter snapshots by the instance whose volumes were snapshotted
Example:
"550e8400-e29b-41d4-a716-446655440000"
Optional. Filter by lifecycle policy ID
Example:
1
Limit of items on a single page
Required range:
x <= 1000Example:
1000
Offset in results list
Required range:
x >= 0Example:
0
Optional. Filter by schedule ID
Example:
"67baa7d1-08ea-4fc5-bef2-6b2465b7d227"
Optional. Filter by volume ID
Example:
"3ed9e2ce-f906-47fb-ba32-c25a3f63df4f"
Was this page helpful?