
# 设置NTP信息
表1设置NTP信息 
| **REST URL格式** |   **访问方法**    |                                                                                                                                                                                                                                 **URI**                                                                                                                                                                                                                                 ||||
| **REST URL格式** |
|---|---|---|---|---|---|
| PUT            | ~https://ip/v1/om/config~                       ||||
| **接口功能**       | 用于第三方设置设备的NTP配置信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |||||
| **接口说明**       | 设置NTP配置信息，包括NTP状态、NTP设置方式、NTP服务器地址                                                                                                                                                                                                                                                                                                                                                                                                                                                     |||||
| **响应数据**       | 参见[表2], [表3]                                                                                                                                                                                                           |||||
| **参数**         | **参数名称**      | **可选/必选/条件必选** | **参数类型** | **位置** | **参数说明**                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **参数**         | synSerTime    | **条件必选**       | int      | 无      | NTP状态 0禁用 1启用                                                                                                                                                                                                                                                                                                                                      |
| **参数**         | ntpGetMode    | **条件必选**       | int      | 无      | NTP设置方式 0自动 1手动 ntp状态为启用时， ntp设置方式可设置                                                                                                                                                                                                                                                                                                                      |
| **参数**         | ntpServerAddr | **条件必选**       | String   | 无      | NTP服务器地址，支持ip和域名 域名：长度1-41 注意： 1:ntp状态启用, 并且ntp设置方式为手动时，ntp服务器地址必选。 2:ntp状态启用，并且ntp设置方式为自动时，请求消息中不需要设置ntpServerAddr |
| **请求消息**       | Header: Cookie: SessionID=xxx Content-Type: application/json; charset=UTF-8 X-Access-Token: xxx  Body: { "cfgItemInt":\[ {"cfgItemID":"synSerTime","cfgItemInfo":1}, {"cfgItemID":"ntpGetMode","cfgItemInfo":1} \], "cfgItemString":\[ {"cfgItemID":"ntpServerAddr", "cfgItemInfo":"ntp.ntsc.ac.cn"} \] } |||||
   
 表2返回值 
| 参数      | 类型     | 取值范围     | 参数说明                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| success | int    | \[0, 1\] | 响应结果 0：失败 1：成功                                                                                                                                                 |
| data    | Object | 可选， 空对象  | 成功返回数据。这里返回空。 例如：{"success":1,"data":""}                                                                                                                                                                                                                                                |
| error   | Object | 可选       | 失败返回错误信息。参见[表3](https://support.huaweicloud.com/ideahub-api/ideahub_05_0327.html#ZH-CN_TOPIC_0000001338414918__zh-cn_topic_0000001260759563_zh-cn_topic_0284492866_zh-cn_topic_0267359051_table187121132124418) 例如：{"success":0,"error":{"id":100666744,"code":134250502,"params":\[\]}} |
   
 表3error 
| 参数    | 类型     | 取值范围     | 参数说明                                                                                                                    |
|:---|:---|:---|:---|
| id    | int    | 32位整数    | 错误id，用于转换。                                                                                                              |
| code  | int    | 32位整数    | 错误码，跟错误id对应，具体含义参考[错误码](https://support.huaweicloud.com/ideahub-api/ideahub_05_0255.html#ZH-CN_TOPIC_0000001309671920)。 |
| param | Object | param 对象 | 失败响应的附带参数。                                                                                                              |
   
