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": [
{
"status": "creating",
"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",
"failure_code": "<string>",
"status_reason": "<string>",
"description": "<string>",
"image_mirror": {
"endpoint": "<string>",
"repository": "<string>",
"api_key_configured": true
},
"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",
"trace_id": "<string>",
"details": {}
}{
"code": "Request.Canceled",
"message": "Request canceled",
"request_id": "req-xxxx"
}{
"code": "System.Internal",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}{
"code": "Request.Timeout",
"message": "Request timed out",
"request_id": "req-xxxx"
}SandboxTemplate
List Templates
Lists Templates visible to the authenticated organization. Results are
sorted by creation time in descending order. Internal artifact IDs are
never returned. name is an exact match on the Template display name;
omit it to list every visible Template.
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": [
{
"status": "creating",
"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",
"failure_code": "<string>",
"status_reason": "<string>",
"description": "<string>",
"image_mirror": {
"endpoint": "<string>",
"repository": "<string>",
"api_key_configured": true
},
"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",
"trace_id": "<string>",
"details": {}
}{
"code": "Request.Canceled",
"message": "Request canceled",
"request_id": "req-xxxx"
}{
"code": "System.Internal",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}{
"code": "Request.Timeout",
"message": "Request timed out",
"request_id": "req-xxxx"
}Authorizations
Query Parameters
Response
Templates were returned successfully.