Namespace: API

API

Methods

staticZOHO.CRM.API.addNotes(config){Promise}

Add Notes to a record
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID Long RecordID to associate the notes.
Title String Notes Title.
Content String Notes Content.
Returns:
Type Description
Promise Resolved with notes creation status
Example
ZOHO.CRM.API.addNotes({Entity:"Leads",RecordID:"1475615000000292033",Title:"Notes Title",Content:"TitleContent"}).then(function(data){
 console.log(data);
});

//prints 
{
  "code": "SUCCESS",
  "details": {
    "created_time": "2017-01-12T04:56:33+05:30",
    "modified_time": "2017-01-12T04:56:33+05:30",
    "modified_by": {
      "name": "Naresh Babu Naresh Babu",
      "id": "1475615000000083003"
    },
    "id": "1475615000000484005",
    "created_by": {
      "name": "Naresh Babu Naresh Babu",
      "id": "1475615000000083003"
    }
  },
  "message": "record added",
  "status": "success"
}

staticZOHO.CRM.API.attachFile(config){Promise}

To delink the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
File String File data
Returns:
Type Description
Promise Resolved user Upload acknowledgement
Example
ZOHO.CRM.API.attachFile({Entity:"Leads",RecordID:"1000000031092",File:blob,FileName:"myFile.txt"}).then(function(data){
	console.log(data);
});
//prints
{
  "code": "SUCCESS",
  "details": {
    "id": "1000000037036"
  },
  "message": "attachment uploaded successfully",
  "status": "success"
}

staticZOHO.CRM.API.deleteRecord(config){Promise}

To delete a record from a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with Response to update record
Example
ZOHO.CRM.API.deleteRecord({Entity:"Leads",RecordID: "1000000049031"})
.then(function(data){
    console.log(data)
})

//prints 
[
   {
        "data": [
           {
                "message": "record updated",
                "details": {
                    "created_by": {
                        "id": "4108880000086001",
                        "name": "Patricia Boyle"
                    },
                    "id": "4108880000478060",
                    "modified_by": {
                        "id": "4108880000086001",
                        "name": "Patricia Boyle"
                    },
                    "modified_time": "2016-04-28T17:59:21+05:30",
                    "created_time": "2016-04-28T17:59:21+05:30"
                },
                "status": "success",
                "code": "SUCCESS"
            }
        ]
    }
]            

staticZOHO.CRM.API.delinkRelatedRecord(config){Promise}

To delink the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
RelatedRecordID String Related Record ID
Returns:
Type Description
Promise Resolved user matching userID
Example
ZOHO.CRM.API.delinkRelatedRecord({Entity:"Leads",RecordID:"1000000079113",RelatedList:"Campaigns",RelatedRecordID:"1000000080041"})
 .then(function(data){
     console.log(data)
 })
//prints
[
  {
    "code": "SUCCESS",
    "details": {
      "id": 1000000080041
    },
    "message": "relation updated",
    "status": "success"
  }
]

staticZOHO.CRM.API.getAllRecords(config){Promise}

get list of all records in a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
sort_order String optional To sort records. allowed values {asc|desc}
converted String optional To get the list of converted records
approved String optional To get the list of approved records
page String optional To get the list of records from the respective pages
per_page String optional To get the list of records available per page
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
ZOHO.CRM.API.getAllRecords({Entity:"Leads",sort_order:"asc",per_page:2,page:1})
.then(function(data){
   console.log(data)
})

//prints 
[
  {
    "Owner": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Company": "Zylkerssssss",
    "Email": null,
    "Description": null,
    "$photo_id": null,
    "Website": null,
    "Twitter": null,
    "$upcoming_activity": null,
    "Salutation": null,
    "Last_Activity_Time": "2017-01-19T17:10:04+05:30",
    "First_Name": null,
    "Full_Name": "Petersonssssss",
    "Lead_Status": null,
    "Industry": null,
    "Modified_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Skype_ID": null,
    "$process_flow": false,
    "$converted": false,
    "Phone": null,
    "Street": null,
    "Zip_Code": null,
    "id": "1000000070208",
    "Email_Opt_Out": false,
    "$approved": true,
    "Designation": null,
    "$approval": {
      "delegate": false,
      "approve": false,
      "reject": false
    },
    "Modified_Time": "2017-01-19T17:10:04+05:30",
    "Created_Time": "2017-01-19T17:09:28+05:30",
    "$converted_detail": {
      
    },
    "$followed": false,
    "City": null,
    "No_of_Employees": 0,
    "Mobile": null,
    "Last_Name": "Petersonssssss",
    "State": null,
    "$status": "cmv_1-1",
    "Lead_Source": null,
    "Country": null,
    "Created_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Fax": null,
    "Annual_Revenue": 0,
    "Secondary_Email": null
  },
  {
    "Owner": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Company": "Zylker",
    "Email": null,
    "Description": null,
    "$photo_id": null,
    "Website": null,
    "Twitter": null,
    "$upcoming_activity": null,
    "Salutation": null,
    "Last_Activity_Time": "2017-01-23T18:34:09+05:30",
    "First_Name": null,
    "Full_Name": "Peterson",
    "Lead_Status": null,
    "Industry": null,
    "Modified_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Skype_ID": null,
    "$process_flow": false,
    "$converted": false,
    "Phone": "1234322",
    "Street": null,
    "Zip_Code": null,
    "id": "1000000070210",
    "Email_Opt_Out": false,
    "$approved": true,
    "Designation": null,
    "$approval": {
      "delegate": false,
      "approve": false,
      "reject": false
    },
    "Modified_Time": "2017-01-23T18:34:09+05:30",
    "Created_Time": "2017-01-19T17:10:40+05:30",
    "$converted_detail": {
      
    },
    "$followed": false,
    "City": null,
    "No_of_Employees": 0,
    "Mobile": null,
    "Last_Name": "Peterson",
    "State": null,
    "$status": "cmv_1-1",
    "Lead_Source": null,
    "Country": null,
    "Created_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Fax": null,
    "Annual_Revenue": 0,
    "Secondary_Email": null
  }
]

staticZOHO.CRM.API.getAllUsers(config){Promise}

To retrieve list of users in ZohoCRM
Name Type Description
config object Configuration Object
Name Type Description
Type String Allowed values "AllUsers | ActiveUsers | DeactiveUsers | ConfirmedUsers | NotConfirmedUsers | DeletedUsers | ActiveConfirmedUsers | AdminUsers | ActiveConfirmedAdmins"
Returns:
Type Description
Promise Resolved List of users matching specified Type
Example
ZOHO.CRM.API.getAllUsers({Type:"AllUsers"})
.then(function(data){
    console.log(data)
})

staticZOHO.CRM.API.getRecord(config){Promise}

get all Details of a record
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with data of record matching with RecordID
Example
ZOHO.CRM.API.getRecord({Entity:"Leads",RecordID:"1000000030132"})
.then(function(data){
    console.log(data)
})

//prints 
[
  {
    "Owner": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Company": "zoho",
    "Email": "svembu@zohocorp.com",
    "Description": null,
    "$photo_id": null,
    "Website": null,
    "Twitter": null,
    "$upcoming_activity": null,
    "Salutation": "",
    "Last_Activity_Time": "2016-12-30T15:09:23+05:30",
    "First_Name": null,
    "Full_Name": "sridhar",
    "Lead_Status": null,
    "Industry": null,
    "Modified_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Skype_ID": null,
    "$process_flow": false,
    "$converted": false,
    "Phone": null,
    "Street": null,
    "Zip_Code": null,
    "id": "1000000049009",
    "Email_Opt_Out": false,
    "$approved": true,
    "Designation": null,
    "$approval": {
      "delegate": false,
      "approve": false,
      "reject": false
    },
    "Modified_Time": "2016-12-30T15:09:23+05:30",
    "Created_Time": "2016-12-30T06:09:44+05:30",
    "$converted_detail": {
      
    },
    "$followed": false,
    "City": null,
    "No_of_Employees": 0,
    "Mobile": "+16692317086",
    "Last_Name": "sridhar",
    "State": null,
    "$status": "cmv_1-1",
    "Lead_Source": null,
    "Country": null,
    "Created_By": {
      "name": "asd devvv",
      "id": "1000000030132"
    },
    "Fax": null,
    "Annual_Revenue": 0,
    "Secondary_Email": null
  }
]

staticZOHO.CRM.API.getRelatedRecords(config){Promise}

To retrive related list records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
Returns:
Type Description
Promise Resolved user matching userID
Example
ZOHO.CRM.API.getRelatedRecords({Entity:"Leads",RecordID:"1000000030132",RelatedList:"Notes"})
.then(function(data){
    console.log(data)
})
//prints

[
	{
		"$approval": {
			"delegate": false,
			"approve": false,
			"reject": false
		},
		"Owner": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Modified_Time": "2017-02-02T19:42:21+05:30",
		"$attachments": [],
		"Created_Time": "2017-02-02T19:42:21+05:30",
		"$followed": false,
		"Parent_Id": {
			"First_Name": null,
			"Last_Name": "Peterson",
			"name": "Peterson",
			"id": "1000000079113"
		},
		"$se_module": "Leads",
		"Modified_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"$size": null,
		"$process_flow": false,
		"$voice_note": false,
		"id": "1000000080035",
		"Created_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Note_Title": "",
		"Note_Content": "Deal closed"
	},
	{
		"$approval": {
			"delegate": false,
			"approve": false,
			"reject": false
		},
		"Owner": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Modified_Time": "2017-02-02T19:42:12+05:30",
		"$attachments": [],
		"Created_Time": "2017-02-02T19:42:12+05:30",
		"$followed": false,
		"Parent_Id": {
			"First_Name": null,
			"Last_Name": "Peterson",
			"name": "Peterson",
			"id": "1000000079113"
		},
		"$se_module": "Leads",
		"Modified_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"$size": null,
		"$process_flow": false,
		"$voice_note": false,
		"id": "1000000080031",
		"Created_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Note_Title": "",
		"Note_Content": "Call Scheduled on 5th jan"
	},
	{
		"$approval": {
			"delegate": false,
			"approve": false,
			"reject": false
		},
		"Owner": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Modified_Time": "2017-02-02T19:41:56+05:30",
		"$attachments": [],
		"Created_Time": "2017-02-02T19:41:56+05:30",
		"$followed": false,
		"Parent_Id": {
			"First_Name": null,
			"Last_Name": "Peterson",
			"name": "Peterson",
			"id": "1000000079113"
		},
		"$se_module": "Leads",
		"Modified_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"$size": null,
		"$process_flow": false,
		"$voice_note": false,
		"id": "1000000080025",
		"Created_By": {
			"name": "asd devvv",
			"id": "1000000030132"
		},
		"Note_Title": "",
		"Note_Content": "Followup Required"
	}
]

staticZOHO.CRM.API.getUser(config){Promise}

To retrieve list of users in ZohoCRM
Name Type Description
config object Configuration Object
Name Type Description
ID String UserID
Returns:
Type Description
Promise Resolved user matching userID
Example
ZOHO.CRM.API.getUser({ID:"1000000030132"})
.then(function(data){
    console.log(data)
})

staticZOHO.CRM.API.insertRecord(config){Promise}

Insert record to a modue
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
APIData Object RecordID to associate the notes.
Returns:
Type Description
Promise Resolved with response data
Examples
var recordData = {
        "Company": "Zylker",
        "Last_Name": "Peterson"
  }
ZOHO.CRM.API.insertRecord({Entity:"Leads",APIData:recordData}).then(function(data){
	console.log(data);
	});
//prints
[
  {
    "code": "SUCCESS",
    "details": {
      "created_time": "2017-01-19T17:10:40+05:30",
      "modified_time": "2017-01-19T17:10:40+05:30",
      "modified_by": {
        "name": "asd devvv",
        "id": "1000000030132"
      },
      "id": "1000000070210",
      "created_by": {
        "name": "asd devvv",
        "id": "1000000030132"
      }
    },
    "message": "record added",
    "status": "success"
  }
]
var data = [
{
        "Company": "ZohoCorp",
        "Last_Name": "Babu"
},
{
	"Company": "ZohoCorp",
    	"Last_Name": "Suganya"
}
];
ZOHO.CRM.API.insertRecord({Entity:"Leads",APIData:data}).then(function(data){
	console.log(data);
});

//prints
[
  {
    "code": "SUCCESS",
    "details": {
      "created_time": "2017-02-02T05:18:53+05:30",
      "modified_time": "2017-02-02T05:18:53+05:30",
      "modified_by": {
        "name": "asd devvv",
        "id": "1000000030132"
      },
      "id": "1000000079113",
      "created_by": {
        "name": "asd devvv",
        "id": "1000000030132"
      }
    },
    "message": "record added",
    "status": "success"
  },
  {
    "code": "MANDATORY_NOT_FOUND",
    "details": {
      "api_name": "Last_Name"
    },
    "message": "required field not found",
    "status": "error"
  }
]

staticZOHO.CRM.API.searchRecord(config){Promise}

To retrieve the records that matches your search criteria
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of module
Type String Allowed values "email|phone|word|criteria"
Query String query String
Returns:
Type Description
Promise Resolved with search result
Examples
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"phone",Query:"12555036573"})
.then(function(data){
    console.log(data)
})
ZOHO.CRM.API.searchRecord({Entity:"Leads",Type:"email",Query:"svembu@zohocorp.com"})
.then(function(data){
    console.log(data)
})

staticZOHO.CRM.API.updateRecord(config){Promise}

To update a record in a module
Name Type Description
config Object Configuration Object.
Name Type Description
Entity String SysRefName of the module.
APIData String Update Record Data.
Returns:
Type Description
Promise Resolved with data of update Record Response
Example
var config={
  Entity:"Leads",
  APIData:{
        "id": "1000000049031",
        "Company": "Zylker",
        "Last_Name": "Peterson"
  }
}
ZOHO.CRM.API.updateRecord(config)
.then(function(data){
    console.log(data)
})

//prints 
[
   {
        "data": [
           {
                "message": "record updated",
                "details": {
                    "created_by": {
                        "id": "4108880000086001",
                        "name": "Patricia Boyle"
                    },
                    "id": "4108880000478060",
                    "modified_by": {
                        "id": "4108880000086001",
                        "name": "Patricia Boyle"
                    },
                    "modified_time": "2016-04-28T17:59:21+05:30",
                    "created_time": "2016-04-28T17:59:21+05:30"
                },
                "status": "success",
                "code": "SUCCESS"
            }
        ]
    }
]            

staticZOHO.CRM.API.updateRelatedRecords(config){Promise}

To update the relation between the records
Name Type Description
config object Configuration Object
Name Type Description
Entity String SysRefName of the module.
RecordID String RecordID to associate the notes.
RelatedListName String SysRefName of the relatedList.
RelatedRecordID String Related Record ID
APIData String Data to be updated in the related record
Returns:
Type Description
Promise Resolved user matching userID
Example
var APIData = {
	Description:"Test description"
 }
 ZOHO.CRM.API.updateRelatedRecords({Entity:"Leads",RecordID:"1000000079113",RelatedList:"Campaigns",RelatedRecordID:"1000000080041",APIData:APIData})
 .then(function(data){
     console.log(data)
 })
//prints
[
  {
    "code": "SUCCESS",
    "details": {
      "id": 1000000080041
    },
    "message": "relation updated",
    "status": "success"
  }
]