
# Manager Java API接口介绍
#### 典型接口说明
以下仅对Manager REST API开发过程中的典型方法进行描述。
表1restApiDemo.src.rest.BasicAuthAcces 
| 方法                                                                                   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|:---|:---|
| loginAndAccess (String webUrl,String userName,String password,String userTLSVersion) | - webUrl 集群首页地址，从配置文件"UserInfo.properties"中获取。     - userName 登录FusionInsight系统的用户名，从配置文件"UserInfo.properties"中获取。     - password userName对应的密码，从配置文件"UserInfo.properties"中获取。   - userTLSVersion TLS的版本。    返回类型：HttpClient 返回：httpClient |
   
![](https://support.huaweicloud.com/devg-lts-mrs/public_sys-resources/note_3.0-zh-cn.png)
- 该接口实现Basic认证登录，并返回登录后的HttpClient，登录过程中用户只需要调用一个接口，简化了使用过程。
- 该接口的入参是从配置文件"UserInfo.properties"中获取的，该文件中的参数需要用户填写，该接口还会调用BasicAuthAccess类内部的多个方法。
 
表2restApiDemo.src.rest.BasicAuthAcces.HttpManager 
| 方法                                                                                                                 | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|
| sendHttpGetRequest(HttpClient httpClient, String operationUrl, String operationName)                               | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpGet操作对应的URL。     - operationName 具体操作的名称。                                                                                                                                                                                                            |
| sendHttpPostRequest(HttpClient httpClient, String operationUrl, String jsonFilePath, String operationName)         | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpPost操作对应的URL。     - jsonFilePath httpPost操作对应的json文件。   - operationName 具体操作名称。                                  |
| sendHttpPostRequestWithString(HttpClient httpClient, String operationUrl, String jsonString, String operationName) | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpPost操作对应的URL。     - jsonString httpPost操作对应的json的String格式。   - operationName 具体操作名称。                                                        |
| sendHttpPutRequest(HttpClient httpclient, String operationUrl, String jsonFilePath, String operationName)          | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpPut操作对应的URL。     - jsonFilePath httpPut操作对应的json文件。   - operationName 具体操作名称。                                                      |
| sendHttpPutRequestWithString(HttpClient httpclient, String operationUrl, String jsonString, String operationName)  | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpPut操作对应的URL。     - jsonString httpPut操作对应的json的String格式。   - operationName 具体操作名称。                                      |
| sendHttpDeleteRequest(HttpClient httpClient, String operationUrl, String jsonString, String operationName)         | - 参数：HttpClient httpClient，登录认证完成后的返回结果。     - operationUrl httpDelete操作对应的URL。     - jsonString httpDelete操作对应的json的String格式。     - operationName 具体操作名称。    |
   
![](https://support.huaweicloud.com/devg-lts-mrs/public_sys-resources/note_3.0-zh-cn.png)
- 以上接口的功能是发送http请求。调用以上接口，用户只需提供每类操作对应的URL，以及操作对应的json文件或json的String格式，无需编写中间的执行代码，减少了代码编写量，简化了用户执行各类操作的步骤。
- 以上接口会返回请求对应的命令编号，方便用户根据命令编号查询命令执行的进度。
 
