Get a Template Build
curl --request GET \
--url https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id}"
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/{template_id}/builds/{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://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{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: 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/{template_id}/builds/{id}"
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/{template_id}/builds/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id}")
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>",
"data": {
"id": "<string>",
"template_id": "<string>",
"trigger": "initial_build",
"status": "waiting",
"artifact_state": "absent",
"source_type": "image",
"resources": {
"cpu_count": 2,
"memory_mb": 2,
"disk_size_mb": 2,
"architecture": "x86_64"
},
"created_at": "2023-11-07T05:31:56Z",
"source": {},
"product": "<string>",
"product_name": "X_SMALL",
"commands": [
"<string>"
],
"start_cmd": "<string>",
"failure": {
"code": "TemplateBuild.OutOfMemory",
"message": "<string>"
},
"started_at": "2023-11-07T05:31:56Z",
"finished_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": "Resource.NotFound",
"message": "The requested resource was not found",
"request_id": "req-xxxx"
}{
"code": "Internal.ServerError",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"details": {}
}SandboxTemplate
Get a Template Build
Returns normalized Build status and artifact availability.
GET
/
templates
/
{template_id}
/
builds
/
{id}
Get a Template Build
curl --request GET \
--url https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id}"
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/{template_id}/builds/{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://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{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: 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/{template_id}/builds/{id}"
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/{template_id}/builds/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/templates/{template_id}/builds/{id}")
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>",
"data": {
"id": "<string>",
"template_id": "<string>",
"trigger": "initial_build",
"status": "waiting",
"artifact_state": "absent",
"source_type": "image",
"resources": {
"cpu_count": 2,
"memory_mb": 2,
"disk_size_mb": 2,
"architecture": "x86_64"
},
"created_at": "2023-11-07T05:31:56Z",
"source": {},
"product": "<string>",
"product_name": "X_SMALL",
"commands": [
"<string>"
],
"start_cmd": "<string>",
"failure": {
"code": "TemplateBuild.OutOfMemory",
"message": "<string>"
},
"started_at": "2023-11-07T05:31:56Z",
"finished_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": "Resource.NotFound",
"message": "The requested resource was not found",
"request_id": "req-xxxx"
}{
"code": "Internal.ServerError",
"message": "An internal server error occurred",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"details": {}
}Authorizations
API Key or Access Token, always sent as Authorization: Bearer <token>. The gateway recognizes the token type automatically.
Path Parameters
Owning GMI Template identifier.
GMI Template Build identifier.