curl命令调用接口

一、post请求

  • 参数是请求体 @RequestBody
curl -H "Authorization:Bearer 5d3d3101-881f-4219-bfdf-b69540f960ba" -H "Content-Type:application/json;charset=UTF-8" -XPOST http://ip:port/addxxx -d '{"task_sn":"VG21","business_system_id":"xxx","vuln_info":[{"vuln_id":"123","vuln_title":"title"}]}'

 

 

public String getToken() {
        String alarmRiskAddress="http://ip:port";
        String getRiskToken="/xxxx/token";

		JSONObject jsonObject=new JSONObject();
		jsonObject.put("type","basic");
		jsonObject.put("clientId", "xxx_api");
		jsonObject.put("clientSecret", "xxx_api");
		HttpHeaders headerss = new HttpHeaders();
		Stri

你可能感兴趣的:(工作中遇到的问题,java,curl)