---
title: "更新主机"
method: PUT
path: "/api/v1/cmdb/hostupdate"
tags: ["CMDB资产管理"]
---

# 更新主机

`PUT /api/v1/cmdb/hostupdate`

更新主机

## Request body

- ModelUpdateCmdbHostDto
  - `groupId` integer, required — 主机分组ID
  - `hostName` string, required — 主机名称(唯一标识)
  - `id` integer — 主机ID
  - `remark` string — 备注信息(可选)
  - `sshIp` string, required — SSH连接IP(公网或私网IP)
  - `sshKeyId` integer, required — SSH凭据ID(从ecsAuth表获取)
  - `sshName` string, required — SSH登录用户名
  - `sshPort` integer — SSH端口(默认22)
  - `vendor` integer — 厂商类型:1->自建,2->阿里云,3->腾讯云

## Response `200`

OK

- ResultResult
  - `code` integer — 状态码
  - `data` unknown
  - `message` string — 提示信息

---

[API](https://skmtc.net/opsre/apis/devops.md) · [All operations](https://skmtc.net/opsre/apis/devops/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/opsre/devops/revisions/25cac8835c4c/schema)
