List Templates
curl --request GET \
--url https://console.gmicloud.ai/api/v2/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.gmicloud.ai/api/v2/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://console.gmicloud.ai/api/v2/templates', 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://console.gmicloud.ai/api/v2/templates",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://console.gmicloud.ai/api/v2/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://console.gmicloud.ai/api/v2/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"total": 1,
"page": 2,
"page_size": 50,
"items": [
{
"id": "<string>",
"name": "<string>",
"idc_name": "<string>",
"source_type": "image",
"resources": {
"cpu_count": 2,
"memory_mb": 2,
"disk_size_mb": 2,
"architecture": "x86_64"
},
"latest_build_id": "<string>",
"latest_build_status": "waiting",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"product": "<string>",
"product_name": "X_SMALL",
"labels": {},
"current_build_id": "<string>",
"rebuildable": true,
"deleted_at": "2023-11-07T05:31:56Z"
}
]
}{
"code": "Parameter.Invalid",
"message": "Invalid request parameters",
"request_id": "req-xxxx"
}{
"code": "Auth.Unauthorized",
"message": "Authentication required",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"details": {}
}{
"code": "Internal.ServerError",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}SandboxTemplate
List Templates
Lists Templates visible to the authenticated organization. Results are sorted by creation time in descending order. Provider artifact IDs are never returned.
GET
/
templates
List Templates
curl --request GET \
--url https://console.gmicloud.ai/api/v2/templates \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.gmicloud.ai/api/v2/templates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://console.gmicloud.ai/api/v2/templates', 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://console.gmicloud.ai/api/v2/templates",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://console.gmicloud.ai/api/v2/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://console.gmicloud.ai/api/v2/templates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"total": 1,
"page": 2,
"page_size": 50,
"items": [
{
"id": "<string>",
"name": "<string>",
"idc_name": "<string>",
"source_type": "image",
"resources": {
"cpu_count": 2,
"memory_mb": 2,
"disk_size_mb": 2,
"architecture": "x86_64"
},
"latest_build_id": "<string>",
"latest_build_status": "waiting",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"product": "<string>",
"product_name": "X_SMALL",
"labels": {},
"current_build_id": "<string>",
"rebuildable": true,
"deleted_at": "2023-11-07T05:31:56Z"
}
]
}{
"code": "Parameter.Invalid",
"message": "Invalid request parameters",
"request_id": "req-xxxx"
}{
"code": "Auth.Unauthorized",
"message": "Authentication required",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"details": {}
}{
"code": "Internal.ServerError",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}Authorizations
API Key or Access Token, always sent as Authorization: Bearer <token>. The gateway recognizes the token type automatically.
Query Parameters
Filter by data center name, e.g. us-denver-1
Page number, starting from 1; default 1
Required range:
x >= 1Items per page; default 20, maximum 100
Required range:
1 <= x <= 100Response
Templates were returned successfully.
HTTP request correlation identifier.
Total number of matching Templates.
Required range:
x >= 0One-based page number.
Required range:
x >= 1Requested number of Templates per page.
Required range:
1 <= x <= 100Show child attributes
Show child attributes