Skip to content
Advertisement

How to add Notes of a contact with Infusionsoft CRM API in Java

In Infusionsoft CRM, there is a field of a contact named as “Notes” to add note for a contact. I was able to create a contact, search or update using xml-rpc protocol, Java. I tried to add notes in the following way (my code below) but couldn’t.

How to add Notes for a contact using their api in Java ?

My approach:

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 text1n");
customField.add("this is text2n");
customField.add("text3n");
customField.add("text4n");
    
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);

Executing the code, it gives this error:

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)

Advertisement

Answer

I just came to know from infusionsoft community post made by @Nicholas_Trecina , added CompletionDate field and made some changes to my code. And it works.

editedVersion:

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);
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement