0
我做了與woo commerce的所有連接,我的產品和所有東西都可以正確取出,但是當我創建一個客戶時,它會給我一個缺少參數數據的錯誤。如何在android應用程序中爲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\": \"[email protected]\"}}";
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", "[email protected]");
cb.params(params);
aQuery.ajax(url, JSONObject.class, cb);