xml-rpcinfusionsoft

Infusionsoft XML RPC API


I am trying to find if a particular tag is applied on a contact. But I am not sure which method to use. I am using infuionsoft XML rpc API https://developer.infusionsoft.com/docs/xml-rpc/ and using PHP. I can add or remove tags from a contact. Here is how I have started

###Set up the call to add to the group###
$call = new xmlrpcmsg("DataService.query", array(
    php_xmlrpc_encode('ourapikey'), #The encrypted API key
    php_xmlrpc_encode('ContactGroupAssign'), //Table to search for tag
    php_xmlrpc_encode(1), //limit
    php_xmlrpc_encode(0), //number of pages 
    php_xmlrpc_encode('Contact.Id => ~=~ 12566'), //i am searching for this contact id

));

###Send the call###
$result = $client->send($call);
 if ($result->faultCode()) {
    echo $result->faultCode() . "<BR>";
    echo $result->faultString() . "<BR>";
}else{
    print_r($result);
}

But I am getting No method matching arguments error. Any help would be highly appricated.


Solution

  • This error means the method you're trying to communicate with expects to get another parameters.

    For a start, taking a closer look at the documentation, you may see selectedFields is required and queryData must be a struct, with PHP you can use an array.

    In your case, these parameters may look this way
    queryData ['ContactId' => 12566]
    selectedFields ['ContactId', 'GroupId']