
# 更新应用版本状态
#### 功能介绍
更新应用版本状态。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/IoTEdge/doc?api=UpdateEdgeApplicationVersionState)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### URI
PUT /v2/{project_id}/edge-apps/{edge_app_id}/versions/{version}/state
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                        |
|:---|:---|:---|:---|
| edge_app_id | 是    | String | 应用ID，应用唯一标识。                                                                              |
| version     | 是    | String | 应用版本,应用内版本唯一。                                                                             |
| project_id  | 是    | String | 项目ID。获取方法请参见 [获取项目ID](https://support.huaweicloud.com/api-iotedge/iotedge_api_0032.html)。 |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务 [获取IAM用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)接口获取，接口返回的响应消息头中"X-Subject-Token"就是需要获取的用户Token。简要的获取方法样例请参见 [Token认证](https://support.huaweicloud.com/api-iothub/iot_06_v5_0091.html#section0)。 |
   
表3请求Body参数 
| 参数    | 是否必选 | 参数类型   | 描述     |
|:---|:---|:---|:---|
| state | 否    | String | 应用版本状态 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数                    | 参数类型             | 描述                  |
|:---|:---|:---|
| edge_app_id           | String           | 应用ID                |
| name                  | String           | 应用名称                |
| version               | String           | 应用名称                |
| sdk_version           | String           | 应用集成的边缘SDK版本        |
| description           | String           | 应用描述                |
| deploy_type           | String           | 部署类型docker\|process |
| deploy_multi_instance | Boolean          | 是否允许部署多实例           |
| create_time           | String           | 创建时间                |
| update_time           | String           | 最后一次修改时间            |
| state                 | String           | 应用版本状态              |
| arch                  | Array of strings | 架构                  |
| publish_time          | String           | 发布时间                |
| off_shelf_time        | String           | 下线时间                |
   
#### 请求示例
```
PUT https://{endpoint}/v2/{project_id}/edge-apps/{edge_app_id}/versions/{version}/state
{
  "state" : "PUBLISHED"
}
```
#### 响应示例
**状态码：200**
OK
```
{
  "edge_app_id" : "test-app",
  "name" : "string",
  "version" : "1.0.0",
  "sdk_version" : "string",
  "description" : "this is a test app",
  "deploy_type" : "string",
  "deploy_multi_instance" : false,
  "create_time" : "2020-05-28T11:31:29.740Z",
  "update_time" : "2020-05-28T11:31:29.740Z",
  "state" : "PUBLISHED",
  "arch" : [ "string" ],
  "publish_time" : "2020-05-28T11:31:29.740Z",
  "off_shelf_time" : "2020-05-28T11:31:29.740Z"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 401 | Bad Request           |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-iotedge/ErrorCode.html)。
