import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 企业对外投资 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-wyixwtnhuar.n.bdcloudapi.com/company_invest/get"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.GET, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("keyword", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"msg": "成功",
"success": true,
"code": 200,
"data": {
"orderNo": "872105044760510145",
"data": [
{
"capital": "500.000000万人民币",
"companyType": "有限责任公司(自然人投资或控股)",
"legalPerson": "刘贵龙",
"companyName": "数脉科技(宁波)有限公司",
"companyStatus": "存续",
"stockProportion": "0.4",
"creditNo": "91330201MA2H46BH3U",
"stockCapital": "200.0",
"establishDate": "2020-03-06 00:00:00"
}
]
}
}
{
"msg": "入参错误,
"success": false,
"code": 400,
"data": { }
}
购买页面上有基于api接口的请求url,入参字段,响应接口结果,和返回错误码描述,请按照要求对接即可