跳转到主要内容
POST
/
gpu-instance
/
openapi
/
v1
/
template
/
update
更新模板
curl --request POST \
  --url https://api.ppinfra.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>",
    "rootfsSize": 123,
    "ports": [
      {
        "type": "<string>",
        "ports": [
          123
        ]
      }
    ],
    "envs": [
      {
        "key": "<string>",
        "value": "<string>"
      }
    ],
    "minCudaVersion": "<string>"
  }
}'
{
  "templateId": "<string>"
}

请求头

Content-Type
string
required
枚举值:application/json。
Authorization
string
required
Bearer 身份验证格式,例如:Bearer {{API 密钥}}。

请求体

template
object
required
模板信息对象,用于定义实例模板配置。

响应参数

templateId
string
required
模板 ID。

示例

请求示例

curl --location --request POST 'https://api.ppinfra.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",
    "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"
}
I