更新模板
curl --request POST \
--url https://api.ppio.com/gpu-instance/openapi/v1/template/update \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"template": {
"Id": "<string>",
"name": "<string>",
"type": "<string>",
"channel": "<string>",
"readme": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{
"type": "<string>",
"ports": [
123
]
}
],
"envs": [
{
"key": "<string>",
"value": "<string>"
}
],
"minCudaVersion": "<string>"
}
}
'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/template/update"
payload = { "template": {
"Id": "<string>",
"name": "<string>",
"type": "<string>",
"channel": "<string>",
"readme": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{
"type": "<string>",
"ports": [123]
}
],
"envs": [
{
"key": "<string>",
"value": "<string>"
}
],
"minCudaVersion": "<string>"
} }
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
template: {
Id: '<string>',
name: '<string>',
type: '<string>',
channel: '<string>',
readme: '<string>',
image: '<string>',
imageAuth: '<string>',
startCommand: '<string>',
entrypoint: '<string>',
rootfsSize: 123,
ports: [{type: '<string>', ports: [123]}],
envs: [{key: '<string>', value: '<string>'}],
minCudaVersion: '<string>'
}
})
};
fetch('https://api.ppio.com/gpu-instance/openapi/v1/template/update', 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.ppio.com/gpu-instance/openapi/v1/template/update",
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([
'template' => [
'Id' => '<string>',
'name' => '<string>',
'type' => '<string>',
'channel' => '<string>',
'readme' => '<string>',
'image' => '<string>',
'imageAuth' => '<string>',
'startCommand' => '<string>',
'entrypoint' => '<string>',
'rootfsSize' => 123,
'ports' => [
[
'type' => '<string>',
'ports' => [
123
]
]
],
'envs' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'minCudaVersion' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.ppio.com/gpu-instance/openapi/v1/template/update"
payload := strings.NewReader("{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.ppio.com/gpu-instance/openapi/v1/template/update")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/gpu-instance/openapi/v1/template/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"templateId": "<string>"
}模板
更新模板
POST
/
gpu-instance
/
openapi
/
v1
/
template
/
update
更新模板
curl --request POST \
--url https://api.ppio.com/gpu-instance/openapi/v1/template/update \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"template": {
"Id": "<string>",
"name": "<string>",
"type": "<string>",
"channel": "<string>",
"readme": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{
"type": "<string>",
"ports": [
123
]
}
],
"envs": [
{
"key": "<string>",
"value": "<string>"
}
],
"minCudaVersion": "<string>"
}
}
'import requests
url = "https://api.ppio.com/gpu-instance/openapi/v1/template/update"
payload = { "template": {
"Id": "<string>",
"name": "<string>",
"type": "<string>",
"channel": "<string>",
"readme": "<string>",
"image": "<string>",
"imageAuth": "<string>",
"startCommand": "<string>",
"entrypoint": "<string>",
"rootfsSize": 123,
"ports": [
{
"type": "<string>",
"ports": [123]
}
],
"envs": [
{
"key": "<string>",
"value": "<string>"
}
],
"minCudaVersion": "<string>"
} }
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
template: {
Id: '<string>',
name: '<string>',
type: '<string>',
channel: '<string>',
readme: '<string>',
image: '<string>',
imageAuth: '<string>',
startCommand: '<string>',
entrypoint: '<string>',
rootfsSize: 123,
ports: [{type: '<string>', ports: [123]}],
envs: [{key: '<string>', value: '<string>'}],
minCudaVersion: '<string>'
}
})
};
fetch('https://api.ppio.com/gpu-instance/openapi/v1/template/update', 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.ppio.com/gpu-instance/openapi/v1/template/update",
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([
'template' => [
'Id' => '<string>',
'name' => '<string>',
'type' => '<string>',
'channel' => '<string>',
'readme' => '<string>',
'image' => '<string>',
'imageAuth' => '<string>',
'startCommand' => '<string>',
'entrypoint' => '<string>',
'rootfsSize' => 123,
'ports' => [
[
'type' => '<string>',
'ports' => [
123
]
]
],
'envs' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'minCudaVersion' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.ppio.com/gpu-instance/openapi/v1/template/update"
payload := strings.NewReader("{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.ppio.com/gpu-instance/openapi/v1/template/update")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/gpu-instance/openapi/v1/template/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"template\": {\n \"Id\": \"<string>\",\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"channel\": \"<string>\",\n \"readme\": \"<string>\",\n \"image\": \"<string>\",\n \"imageAuth\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"entrypoint\": \"<string>\",\n \"rootfsSize\": 123,\n \"ports\": [\n {\n \"type\": \"<string>\",\n \"ports\": [\n 123\n ]\n }\n ],\n \"envs\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"minCudaVersion\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"templateId": "<string>"
}请求头
枚举值:application/json。
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。
请求体
模板信息对象,用于定义实例模板配置。
隐藏 properties
隐藏 properties
模板 ID。长度:[1-255]。
模板名称。长度:[1-255]。
模板类型。可选值:
instance
模板可见性。可选值:
private
模板说明,支持 Markdown。长度:[0-102400]。
镜像地址,可为公共镜像或私有镜像。长度:[1-500]。
私有镜像认证信息 ID。长度:[0-255]。
启动命令。长度:[0-2047]。
实例启动 entrypoint。该配置会覆盖 Docker 镜像的 ENTRYPOINT。长度:[0-2047]。
系统盘大小(单位:GB)。取值范围:> 0。
模板支持的最小 CUDA 版本,需填写指定格式,例如:11.8、12.4。长度:[0-255]。
响应参数
模板 ID。
示例
请求示例
curl --location --request POST 'https://api.ppio.com/gpu-instance/openapi/v1/template/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API 密钥}}' \
--data-raw '{
"template": {
"Id": "101036",
"name": "test",
"type": "instance",
"channel": "private",
"readme": "test create template",
"image": "nginx",
"imageAuth": "",
"startCommand": "echo test",
"entrypoint": "",
"rootfsSize": 60,
"ports": [
{"type": "http", "ports": [80, 443]},
{"type": "tcp", "ports": [90, 95]}
],
"envs": [
{"key": "test1", "value": "template1"},
{"key": "test2", "value": "test2"}
],
"minCudaVersion": "11.8"
}
}'
响应示例
{
"templateId": "101036"
}
最后修改于 2026年6月16日
⌘I