How To Insert Record in Zoho CRM Modules

Here we learn How to insert record in ZOHO modules using Curl request.

Insert Record In Zoho Module

Before making the api call to Insert records with the rest apis we need to follow some Steps.

1: To generate the Auth Token, you need to follow Below URL.

https://www.thecodehubs.com/generate-access-code-using-postman-for-zoho

2: Create zoho-insert.php file to insert record in module and put below code in this file.

Request URL :

https://www.zohoapis.com/crm/v2/{module_name}

Where,
       Module_name: The API name of the module
      Possible_Module_name: leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and notes.

<?php 
 
$header = array(
    'Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf" 
);
$data = array(
      'data' => array(
              array(
                  'Company' => 'testing-company',
                  'Last_Name' => 'testing',
                  'First_Name' => 'test',
                  'Email' => 'testingtest@gmail.com',
                  'State' => 'Texas',
                ),
              ),
      'trigger' => array(),
    );
$data_json = json_encode( $data );

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://www.zohoapis.com/crm/v2/{Module_name}");
curl_setopt( $curl, CURLOPT_HTTPHEADER, $header );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "PUT" );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data_json ); 
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$response = curl_exec($ch);
curl_close($ch);
?>

While inserting records there are a few Mandatory fields that you need to mention.

Module mandatory field
Leads Last_Name – Single Line
Contacts Last_Name – Single Line
Accounts Account_Name – Single Line
Deals Deal_Name- Single Line
Stage – Picklist
Tasks Subject – Multi Line
Calls Subject – Multi Line
Call_Type – Picklist
Call_Start_Time – Date/Time
Call_Duration – Single Line
Events Event_Title- Single Line
Start_DateTime – Date/Time
End_DateTime – Date/Time
Products Product_Name – Single Line
Quotes Subject- Single Line
Product_Details – Product Line Item
Invoices Subject- Single Line
Product_Details – Product Line Item
Campaigns Campaign_Name – Single Line
Price Books Price_Book_Name- Single Line
Pricing_Details- JSON Array with “from_range”, “to_range”, “discount”
Cases Case_Origin – Picklist
Status- Picklist
Subject – Single Line
Solutions Solution_Title- Single Line
Purchase Orders Subject- Single Line
Vendor_Name- Lookup
Product_Details – Product Line Item
Sales Orders Subject- Single Line
Product_Details – Product Line Item

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories