1

我正在使用 Java 和 Infusionsofts API 来获取基于客户 ID 的联系人列表。我想不出办法来做到这一点。我正在使用 Googles Guava 来使用 multimap,但它会产生错误:

org.apache.xmlrpc.common.XmlRpcExtensionException: Serializable objects are not supported, if isEnabledForExtensions() == false

所以现在我正在尝试 hashmap,我正在插入“Id”作为键,客户 id 作为值,但哈希图中总是有一个条目。

如何将包含以下内容的映射添加到参数变量中:
["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");
    }
4

0 回答 0