PHP-SDK Delete Records Example

PHP-SDK Delete Records Example

Greetings,

I am using the API 2.0 with the PHP-SDK.

I have figured out how to Upsert & Update Records thansk to the help of other members of the forum and zoho support. Now I am trying to figure out how to mass delete records. Bascially cleanup my mistakes :) 

I see a deleteRecords function but I can't figure out how to pass an array or entity ID's to this function. If anyone else has any help or can point me in the right direction. 

Thanks,

Josh

My Code, I am just pasting the pertinent parts, please excuse all the extra fluff i have for debugging. 

  1.  $entityID = $row['ZohoID'];
  2.   echo "Row: ".$count." || ContactID: " . $entityID . " || Contact: ".$row['FirstName'] . " " .$row['LastName'];
  3.   $records = ZCRMRecord::getInstance("Contacts",$entityID);

  4.   //*Add to Array
  5.   $recordsArray[]=$records;
  6.  if ($count == 1 || $totalCount == $numRows){
  7.   echo "<hr><hr>",EOL;
  8.   //Reset Count
  9.   $count =0;
  10.  //Upload Full Records Array 
  11.      $zcrmModuleIns = ZCRMModule::getInstance("Contacts"); 
  12.        $bulkAPIResponse=$zcrmModuleIns->deleteRecords($recordsArray); 
  13.      
  14.      $entityResponses = $bulkAPIResponse->getEntityResponses(); 
  15.      foreach($entityResponses as $entityResponse) 
  16.     
  17.      if("success"==$entityResponse->getStatus()) 
  18.      { 
  19.      echo "Status:".$entityResponse->getStatus();
  20.      echo "Message:".$entityResponse->getMessage();
  21.      echo "Code:".$entityResponse->getCode();
  22.      //$updateData=$entityResponse->getUpsertDetails();
  23.      //echo "UPDATE_ACTION:".$updateData["action"];
  24.      //echo "UPDATE_DUPLICATE_FIELD:".$updateData["duplicate_field"];
  25.      //$createdRecordInstance=$entityResponse->getData();
  26.      //echo "EntityID:".$createdRecordInstance->getEntityId();
  27.    //echo "moduleAPIName:".$createdRecordInstance->getModuleAPIName();
  28.   
  29.    //Insert ID back into Solaria
  30.   $deleteQUERY = " DELETE FROM CRMContactID 
  31.    WHERE ZohoID = ".ZCRMRecord::getInstance("Contacts",$entityID)." ";

  32.   //execute query 
  33.   $DeleteResult = $mspdo->query($deleteQUERY);
  34.   
  35.   echo "<hr><hr>",EOL;
  36.      }
  37.      else
  38.      {
  39.    echo "<b>Error</b>",EOL;  
  40.    echo "<b>Status:</b>".$entityResponse->getStatus(), EOL;
  41.    echo "<b>Message:</b>".$entityResponse->getMessage(), EOL;
  42.    echo "<b>Code:</b>".$entityResponse->getCode(), EOL;
  43. echo "<hr><hr>",EOL;
  44.      }
  45.   
  46.    }

  47. break;