我完成了与woo commerce的所有连接,我的产品和所有东西都可以正常获取,但是当我创建一个客户时,它给我一个错误的参数数据缺失。
aQuery = new AQuery(context);
HashMap<String, String> stringStringHashMap = new HashMap<>();
String url = WooCommerceAuthentication.getUrl("POST&", "customers", stringStringHashMap);
AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>() {
@Override
public void callback(String url, JSONObject jsonObject, AjaxStatus status) {
System.out.println(jsonObject);
}
};
String data = "{\n" +
"\t\"customer\": {\n" +
"\t\t\"email\": \"myddemaideelo@gmail.com\"}}";
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(data);
} catch (JSONException e) {
e.printStackTrace();
}
cb.header("Accept", "application/json");
cb.header("Content-Type", "application/json");
cb.header("User-Agent", "WooCommerce API Client-PHP/2.0.1");
Map<String, Object> params = new HashMap<String, Object>();
params.put("method", "POST");
params.put("data", "chandan24892@gmail.com");
cb.params(params);
aQuery.ajax(url, JSONObject.class, cb);
答案 0 :(得分:0)
您提交的客户信息不完整。根据文档here,客户字段应为,
# app/config/config.yml
liip_theme:
# ...
assetic_integration: true