import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.lang.Dict;
import cn.hutool.http.HttpUtil;
public class YsApiData {
private String code = "";
private String appKey = "Q+AYwnG35MMpP+LZrfmaMA==";
private Object inputData = null;
public YsApiData(String code) {
this.code = code;
}
public YsApiData(String code, String appKey) {
this.code = code;
this.appKey = appKey;
}
public YsApiData(String code, Object inputData) {
this.code = code;
this.inputData = inputData;
}
public YsApiData(String code, String appKey, Object inputData) {
this.code = code;
this.appKey = appKey;
this.inputData = inputData;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Object getInputData() {
return inputData;
}
public void setInputData(Object inputData) {
this.inputData = inputData;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
public static void main(String[] args) throws Exception{
YsApiData data = new YsApiData("1003");
Dict dict = new Dict();
dict.set("relation_id", 18554650);
dict.set("num_stock", 500);
data.setInputData(dict);
String retJosn =HttpUtil.post("http://www.ysyao.com/api/interface/doInterface",data.toString());
System.out.println(retJosn);
}
}
文档更新时间: 2020-08-01 16:53 作者:陈剑良