How to delete company using XML-RPC?

This is a follow-up from this previous question of mine.
Since the answer to that question suggested to use XML-RPC instead.

to perform Delete operation to Companies.

Doing what this suggested.

XML File

 <?xml version='1.0' encoding='UTF-8'?>

Laravel PHP Code

  $xml = simplexml_load_file('C:\path\to\temp.xml');

    $fullTokenObj = unserialize(auth()->user()->token);
    $connection_URL = ''
        . $fullTokenObj->getAccessToken();

    $client = new GuzzleClient();
    $response = $client->request('POST', $connection_URL, [
      'headers' => [
          'Content-Type' => 'text/xml; charset=UTF8',
    	'body' => $xml


But the response just returns:

Response {#594
-reasonPhrase: “OK”
-statusCode: 200
-headers: array:25 [:arrow_forward:]
-headerNames: array:25 [:arrow_forward:]
-protocol: “1.1”
-stream: Stream {#592 :arrow_forward:}

When I get the list of companies using REST, there was no change in the companies list. Company ID#25 is not deleted.

I’m not sure which part I may have missed. I also tried adding a company suggested there too. but the new company is not reflected. Is there another configuration setting in order to use XML-RPC?


It would be far easier to use the data service object using the api SDK. you can use the dsDelete/Delete method straight out rather that recreating the wheel. It will allow you to remove the company record by directly addressing the Company table.

Thank you for your reply. The DataService object nailed it!

$infusionsoft->data()->delete(‘Company’, 21); // this works!

For future reference, I found that the CompanyService doesn’t allow FIND and DELETE for some reason.

class CompanyService extends RestModel
use CannotSync, CannotDelete, CannotFind;

1 Like