【发布时间】:2018-06-24 05:36:10
【问题描述】:
我正在使用 Mailchimp,我想向我的列表发送一个电子邮件地址,到目前为止,我已经使用 Volley 完成了此操作:
public void suscribeMailChamp(){
String listid = "listID";
String url = "https://us16.api.mailchimp.com/3.0/lists/" + listid + "/members/";
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest sr = new StringRequest(Request.Method.POST,url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//
Toast.makeText(MainActivity.this , "success" , Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this , error.toString() , Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put("email_address","testmailchimp@gmail.com");
params.put("status","unsubscribed");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params = new HashMap<String, String>();
params.put("Content-Type","application/x-www-form-urlencoded");
params.put("Authorization" , "apikey <here my api key>");
return params;
}
};
queue.add(sr);
}
但我收到错误 400:
意外的响应代码 400 https://us16.api.mailchimp.com/3.0/lists/b9a5943047/members/
这是一个故障排除链接,但我无法得到错误:
http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
【问题讨论】:
标签: android post android-volley mailchimp