While inserting data in Zoho crm account via api call or third party service, you will need three required parameter.
– authtoken : It is the encrypted alphanumeric string.
– xmlData : This the XML string data which you need to insert in zoho crm
– scope : use scope as crmapi
Step 1: To insert new lead data in zoho crm account, first create an XML string as below:
1 2 3 4 5 6 7 8 9 10 11 12 |
$xml = '<?xml version="1.0" encoding="UTF-8"?>'; // same error with or without this line $xml .= '<Leads>'; $xml .= '<row no="1">'; $xml .= '<FL val="Lead Source">Slide Share</FL>'; $xml .= '<FL val="Company">'company name'</FL>'; $xml .= '<FL val="First Name">'first name'</FL>'; $xml .= '<FL val="Last Name">'last name'</FL>'; $xml .= '<FL val="Email">'email id'</FL>'; $xml .= '<FL val="Phone">'phone'</FL>'; $xml .= '<FL val="Country">'country'</FL>'; $xml .= '</row>'; $xml .= '</Leads>'; |
Use this api base url for access it : https://crm.zoho.com/crm/private/xml/Leads/insertRecords/authtoken=*****auth token*****&scope=crmapi&newFormat=1&xmlData=
You May Also Like:
How to Authenticate with D&B Direct API Web Service
How to Add New Product in Bigcommerce via API V2
How to Connect With Cloudshare Rest API
How to Get Opportunity Data from Salesforce Through API in PHP
How to Install Magento Security Patch via Putty
Step 2: Use the below code to insert lead data in zoho crm
1 2 3 4 5 6 7 8 9 10 11 12 |
$url ="https://crm.zoho.com/crm/private/xml/Leads/insertRecords"; $query="authtoken=*******ad1599872bd********&scope=crmapi&newFormat=1&xmlData=".$xml; $chzoho = curl_init(); curl_setopt($chzoho, CURLOPT_URL, $url); curl_setopt($chzoho, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($chzoho, CURLOPT_RETURNTRANSFER, 1); curl_setopt($chzoho, CURLOPT_TIMEOUT, 30); curl_setopt($chzoho, CURLOPT_POST, 1); curl_setopt($chzoho, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl. $response = curl_exec($chzoho); curl_close($chzoho); echo $response; |
After complete the steps you will get the success response and new lead data inserted in youe zoho crm account.
How do you handle in case there are & and special characters in the xml data.
Hi Arun,
Can you please show me your XML data, which you trying to insert in zoho crm.
You may try adding & symbol in the company name in your sample. ‘company & name’;. It will return 4835Unable to parse XML data ;
$xml .= ”;
$xml .= ”;
$xml .= ‘Slide Share’;
$xml .= ‘company & name’;
$xml .= ‘first name’;
$xml .= ‘last name’;
$xml .= ’email id’;
$xml .= ‘phone’;
$xml .= ‘country’;
$xml .= ”;
$xml .= ”;
Hi Arun,
You have to use this & instead of & symbol in xml. OR you can remove this & symbol before passing in xml request.
I assume you mean ‘&’ instead of &. I tried it. Still the same error.