我正在使用Java和Infusionsofts API根据客户ID获取联系人列表。我无法想办法做到这一点。我正在使用Googles Guava来使用multimap,但它产生了一个错误:
org.apache.xmlrpc.common.XmlRpcExtensionException:如果isEnabledForExtensions()== false,则不支持可序列化对象
所以现在我正在尝试使用hashmap,我将“Id”作为键并将客户ID作为值插入,但是在hashmap中总是有一个条目。
如何向参数变量添加包含以下内容的地图:
[ “ID”,11111]
[ “ID”,22322]
[ “ID”,44444]
List parameters = new ArrayList();
parameters.add(APP_ID);
parameters.add(TABLE_NAME);
parameters.add(LIMIT);
parameters.add(pageNumber);
HashMap<String, Integer> map = new HashMap<String, Integer>();
for(int customerId : customerIds){
map.put("Id", customerId);
}
//PROBLEM IS HERE
parameters.add(map);
//THIS IS THE PROBLEM, I NEED TO ADD ["Id", customerId] multiple
//times with the customerId being different but since there's a hashmap
//There's always 1 entry in the map
String[] fields = {"Email","FirstName"};
parameters.add(fields);
Object[] contacts = null;
try{
contacts = ( Object [] ) client.execute("DataService.query",parameters);
}catch(XmlRpcException e){
e.printStackTrace();
}
for (int i = 0; i < contacts.length; i++) {
Map contact = (Map) contacts[i];
System.out.println(contact+"\n\n");
}