0

在infusionsoft CRM 中,有一个名为“Notes”的联系人字段,用于为联系人添加注释。我能够使用 xml-rpc 协议、java 创建联系人、搜索或更新。我尝试通过以下方式添加注释(我的代码如下)但不能。有人可以帮我了解如何在 java 中使用他们的 api 为联系人添加注释吗?

我的方法:

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
XmlRpcClient client = new XmlRpcClient();
config.setServerURL(new URL(uri)); //my app uri
client.setConfig(config);

List params=new ArrayList();
List customField=new ArrayList();
customField.add("this is new text1\n");
customField.add("this is text2\n");
customField.add("text3\n");
customField.add("text4\n");

params.add(api_key);        
params.add("ContactNotes");//found from contact Table-schema
params.add(customField);
params.add(contactId); //suppose that was an known contactId Integer.
Integer responseCode=(Integer) client.execute("ContactService.add", params);

执行代码,它给出了这个错误:

org.apache.xmlrpc.XmlRpcException: No method matching arguments: java.lang.String, java.lang.String, [Ljava.lang.Object;, java.lang.Integer
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at infusionsoft.ContactOperation.addNote(ContactOperation.java:123)
at infusionsoft.Main.main(Main.java:80)
4

1 回答 1

0

我刚刚从@Nicholas_Trecina发布的infusionsoft 社区帖子中了解到,添加了CompletionDate字段并对我的代码进行了一些更改。它有效。

编辑版本:

List params = new ArrayList();      
Map noteData = new HashMap();

noteData.put("ContactId", contactId);
noteData.put("ActionDescription", "My Note Title");
noteData.put("isAppointment", 0);
noteData.put("ActionDate","20170803T08:00:00");
noteData.put("CompletionDate","20171109");
noteData.put("CreationNotes", "Note data- what i want to save as note: bla bla bla..");

params.add(api_key);        
params.add("ContactAction");            
params.add(noteData);

Integer responseCode = (Integer) client.execute(
                "DataService.add", params);
于 2017-11-09T06:53:30.670 回答