Join us in the Zoho Extensions Development Bootcamp scheduled across cities in India Register Now

Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Easy domain registration, transfer, and secured DNS management.

Try now
New

Payroll software with automated tax payments and filing.

Try now
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Unified payment solution built for all businesses.

Try now
New

Comprehensive email security and archiving for every business.

Try now
Suites

Cloud-based qualitative data analysis tool.

Try now
New

Online community platform for individuals and businesses to grow their network and brand.

Try now
New

Modern retail POS to sell better, manage your entire business, and join the digital revolution.

Try now
SuitesNew

Unified project management platform for intelligent, data-driven work.

Try now
Suites

Unified platform for customer service and support teams.

Try now

Sales

CRM

Comprehensive CRM platform for customer-facing teams.

CRM
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
Thrive

Complete loyalty and affiliate management platform.

Thrive
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Social

All-in-one social media management software.

Social
Survey

Design surveys to reach and interact with your audience.

Survey
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Sites

Online website builder with extensive customisation options.

Sites
Backstage

End-to-end event management software.

Backstage
PageSense

Website conversion optimization and personalisation platform.

PageSense
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
Webinar

Webinar platform for webcasting online webinars.

Webinar
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
NEW
Domains

Easy domain registration, transfer, and secured DNS management.

Domains
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
Thrive

Complete loyalty and affiliate management platform.

Thrive
Publish

Manage all your local business listings on a single platform.

Publish
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

Desk

Helpdesk software to deliver great customer support.

Desk
Assist

Remote support and unattended remote access software.

Assist
Voice

Cloud Contact Center Software for businesses.

Voice
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
FSM

End-to-end field service management platform for service businesses.

FSM
Lens

Interactive remote assistance software with augmented reality.

Lens
Solo

The all-in-one toolkit for solopreneurs.

Solo
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

Books

Powerful accounting platform for growing businesses.

Books
Expense

Effortless expense reporting platform.

Expense
Sign

Digital signature app for businesses.

Sign
Inventory

Powerful stock management and inventory control software.

Inventory
FREE
Invoice

100% Free invoicing solution.

Invoice
Billing

End-to-end billing solution for your business.

Billing
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Commerce

eCommerce platform to manage and market your online store.

Commerce
Checkout

Collect payments online with custom branded pages.

Checkout
Practice

Practice management software for accounting firms.

Practice
Solo

The all-in-one toolkit for solopreneurs.

Solo
NEW
Payments

Unified payment solution built for all businesses.

Payments
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email, Storage, and Collaboration

Mail

Secure email service for teams of all sizes.

Mail
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
WorkDrive

Online file management for teams.

WorkDrive
Bookings

Appointment scheduling app for consultations with customers.

Bookings
Cliq

Stay in touch with teams no matter where you are.

Cliq
Notebook

Beautiful home for all your notes.

Notebook
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
Learn

Knowledge and learning management platform.

Learn
Office Integrator

Built in document editors for web apps.

Office Integrator
Writer

Word processor for focused writing and discussions.

Writer
TeamInbox

Shared inboxes for teams.

TeamInbox
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Show

Create, edit, and share slides with a sleek presentation app.

Show
Tables

Work management tool to connect people, processes, and information.

Tables
Sheet

Spreadsheet software for collaborative teams.

Sheet
Office Suite

Powerful collaborative work platform for teams.

Office Suite
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
ToDo

Collaborative task management for individuals and teams.

ToDo
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

Expense

Effortless expense reporting platform.

Expense
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
People

Organize, automate, and simplify your HR processes.

People
Sign

Digital signature app for businesses.

Sign
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Shifts

Employee scheduling and time tracking app.

Shifts
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

Creator

Build custom apps to simplify business processes.

Creator
Assist

Remote support and unattended remote access software.

Assist
Vault

Online password manager for teams.

Vault
Directory

Workforce identity and access management solution for cloud businesses.

Directory
Lens

Interactive remote assistance software with augmented reality.

Lens
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
NEW
eProtect

Comprehensive email security and archiving for every business.

eProtect
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit

BI and Analytics

Analytics

Modern self-service BI and analytics platform.

Analytics
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI

Project Management

Projects

Manage, track, and collaborate on projects with teams.

Projects
Sprints

Planning and tracking tool for scrum teams.

Sprints
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
Solo

The all-in-one toolkit for solopreneurs.

Solo
Suites
Projects Plus

Unified project management platform for intelligent, data-driven work.

Projects Plus

Developer Platforms

Creator

Build custom apps to simplify business processes.

Creator
Flow

Automate business workflows by creating smart integrations.

Flow
Office Integrator

Built in document editors for web apps.

Office Integrator
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Tables

Work management tool to connect people, processes, and information.

Tables
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
Apptics

Application analytics for all apps.

Apptics
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI

IoT

NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
Projects Plus

Unified project management platform for intelligent, data-driven work.

Try now
Projects Plus
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Skip to main content

REST API Functions

The REST API function provides you the flexibility of triggering it from anywhere - within a function in an extension or from a third-party application. Third-party applications can invoke these API functions as webhook URL. There are two versions of the REST API function (explained in detail in later sections).

Authentication

The REST API function uses the API Key authentication method. The value of the ZAPI key to be used can be obtained using one of the following:

  • Custom Functions
  • Installation scripts

Using Custom Functions

  1. Publish the extension in which the REST API Function is included and install the extension.
  2. Log in to your application.
  3. Go to Setup > Automation > Actions and select the Functions tab.
  4. Click the Configure Function button.
  5. Click the Write your own link.
  6. In the Deluge Script Editor, paste the following code snippet and click Save & Execute Script

    m = {"nameSpace" : "<portal_name.extension_namespace>"};
    apikeyresp = zoho.crm.invokeConnector("crm.zapikey",m);
    zapikey = apikeyresp.get("response");
    info zapikey;

  7. The ZAPI key will be displayed in the Log messages.

Using Installation Scripts

  1. Log in to your Zoho Developer console and click Extensions for Zoho CRM.
  2. Select the extension in which the REST API Function is included, then click Edit.
  3. Select Custom Properties in the left pane.
  4. Click the Create button.
  5. Enter a variable name in  Field Name and API Name fields and click Save.
    This variable will be used in the installation script to store the URL of the REST API function (details are explained in the steps below).
  6. Select Install Actions in the left pane.
  7. Click Extension - On Installation.
  8. In the Deluge Script Editor, paste the below code snippet and click Save.  

    m = { "nameSpace" : "<portal_name.extension_namespace>" };
    apikeyresp = zoho.crm.invokeConnector("crm.zapikey", m);
    zapikey = apikeyresp.get("response");
    url = "https://platform.zoho.com/crm/v2/settings/custom_functions/<extension_namespace.
            function_name>/execute?zapikey=" + zapikey;
    m = { "apiname" : "<extension_namespace.variable_name>", "value" : url };
    r = zoho.crm.invokeConnector("crm.set", m);
    info r;

  9. Publish the extension in which the REST API Function is included and install the extension.
  10. Log in to your application.
  11. Go to Setup > Marketplace > All > Installed and click the extension name.
    The value of the variable "apifunctionurl" will be displayed under the Extension Settings section of the Extension Details page. This variable will have the ZAPI key value.

Version 2.0

Details of the Version 2.0 of the REST API function are given below:

Request Object

The entire request object of the function is stored in crmAPIRequest. The need to create multiple arguments within the function is eliminated as the crmAPIRequest object dynamically stores the information from the request and makes it available inside the function. The request object will be automatically mapped to the crmAPIRequest argument.

Input Types

NameDescription
BodyAny content that is passed as a stream to the request can be fetched using the component "Body" of crmAPIRequest.
request_body = crmAPIRequest.get("body");
ParametersThe parameter values passed in the request (either as key-value pair or as JSON object) can be fetched using the component "params" of crmAPIRequest.
parameters = crmAPIRequest.get("params");
File ContentAny Multipart content like a file can be fetched using the component "file_content" of crmAPIRequest.
filecontent = crmAPIRequest.get("file_content");
User InformationDetails about the user can be fetched using the component "user_info" of crmAPIRequest. If API key method is used, then details of the super admin is obtained.
user_info = crmAPIRequest.get("user_info");
Authentication MethodThe name of the HTTP method (GET, POST, etc.) used in the request can be fetched using the component, "method" of crmAPIRequest.
method = crmAPIRequest.get("method");
Authentication TypeThe name of the authentication method (API Key) used in the request can be fetched using the component "auth_type" of crmAPIRequest.
authtype = crmAPIRequest.get("auth_type");
HeadersThe information that is available in header (e.g. additional information about the request) can be fetched using the component "headers" of crmAPIRequest.
headers = crmAPIRequest.get("headers");

The input for the function can be acquired from the following types:

Body

Sending body using POSTMAN as a stream (raw):

Sending body using POSTMAN as a binary file:

To get the entire body section of the request in a function:

crmAPIRequestMap = crmAPIRequest.toMap();
request_body = crmAPIRequestMap.get("body");
company = request_body.get("Company");
name = request_body.get("last_name");
m = Map();
m.put("Last_Name",name);
m.put("Company",company);
r = zoho.crm.createRecord("Leads",m);
return "Lead created successfully ::: ";

In POSTMAN, the body content can be passed either in the raw or binary.

Parameters

Sending parameters using POSTMAN, within the request URL:

Sending parameters using POSTMAN as keys in form-data:

To get the additional parameters used in the request:

crmAPIRequestMap = crmAPIRequest.toMap();
parameters = crmAPIRequestMap.get("params");
company = parameters.get("Company");
name = parameters.get("last_Name");
m = Map();
m.put("Last_Name",name);
m.put("Company",company);
r = zoho.crm.createRecord("Leads",m);
return "Lead created successfully ::: ";

Sending parameters using POSTMAN, as JSON objects in form-data:

To get the additional parameters used in the request:

crmAPIRequestMap = crmAPIRequest.toMap();
parameters = crmAPIRequestMap.get("params");
args = parameters.get("args");
company = args.get("Company");
name = args.get("last_name");
m = Map();
m.put("Last_Name",name);
m.put("Company",company);
r = zoho.crm.createRecord("Leads",m);
return "Lead created successfully ::: ";

File Content

The file types currently supported are the text files. In order to send the file to the function as a multipart data, send it under the argument name "inputFile".

To get the file uploaded to be used in the function:

crmAPIRequestMap = crmAPIRequest.toMap();
parameters = crmAPIRequestMap.get("file_content");
company = parameters.get("Company");
name = parameters.get("last_name");
m = Map();
m.put("Last_Name",name);
m.put("Company",company);
r = zoho.crm.createRecord("Leads",m);
return "Lead created successfully ::: ";

User Information

To get the info about the users:

crmAPIRequestMap = crmAPIRequest.toMap();
// to get the user info of the request
user_info = crmAPIRequestMap.get("user_info");
/**
Your Business Logic here
**/
return crmAPIRequestMap;

Authentication Type and Method

To get the info about the authentication type:

crmAPIRequestMap = crmAPIRequest.toMap();
// to get the HTTP method of the request
user_info = crmAPIRequestMap.get("method");
// to get the authentication type of the request
user_info = crmAPIRequestMap.get("auth_type");
/**
Your Business Logic here
**/
return crmAPIRequestMap;

Headers

To get the headers of the request:

crmAPIRequestMap = crmAPIRequest.toMap();
// to get the user info of the request
header_request = crmAPIRequestMap.get("headers");
/**
Your Business Logic here
**/
return crmAPIRequestMap;

Return Type

The default return type is String in Version 2.0. You can specify the return message as String or you can define response object by using crmAPIResponse(explained below).

Response Object

In the argument crmAPIResponse, you can define the following specifications about the response:

Status Code: Use this key to define the status of the API call (successful or bad request). The default status code is 200.

response = Map();
response.put("status_code",204);
return {"crmAPIResponse":response};

Content-Type: Use this key to define the format in which you want the response. The default value of this key is application/json;charset=utf-8.

response = Map();
response.put("Content-Type","application/text");
return {"crmAPIResponse":response};

Headers: Use this key to define the values in header. The default value of this key is {"Content-Disposition", "attachment;filename=response.json"}.

response = Map();
headers = Map();
headers.put("X-ZOHO-SOURCE","CRM");
headers.put("X-Frame-Options","SAMEORIGIN");
headers.put("X-RATELIMIT-LIMIT","60");
response.put("headers",headers);
return {"crmAPIResponse":response};

Body: Use this key to pass the information that you need to send to the third-party as a response to their request. The default value of body is empty.

response = Map();
body = "{<xml>}"
response.put("body",body);
return {"crmAPIResponse":response};

Version 1.0

Request Object

KeyValue
parametersThese are the map type entities found in requestMap as key-value pairs. For Example, in the URL, https://platform.zoho.com/crm/v2/settings/custom_functions/
<extension_namespace.function_name>/execute?zapikey=apikey&action=mailreceived
, parameter is received as{"action":"mailreceived"} where "action" is the parameter name
and "mailreceived" is the parameter value. Then the map is got through the following code,
params = requestMap.get("parameters");
tp_event_responseIf the third party service sends data in InputStream, then the map is got through the code,
response = input.requestMap.get("tp_event_response")
fileContentAny Multipart content like a file can be fetched using the component "file_content" of requestMap.
filecontent = input.requestMap.get("fileContent");

Example

The following function code snippet calls the third-party "Twilio" REST API as a webhook and associates it with the application,

//use this for v1.0
twilioResp = (requestMap.get("parameters")).toMap();
//use this for v2.0
twilioResp = (crmAPIRequest.get("params")).toMap();
//below lines are common for both the versions
fromNumber = twilioResp.get("From");
messageContent = twilioResp.get("Body");
LeadRespList = zoho.crm.searchRecords("Leads", "(Mobile:equals:" + fromNumber + ")");
for each LeadResp in LeadRespList
{
LeadId = LeadResp.get("id");
if ((LeadId == null) || (LeadId == ""))
{
LeadId = "";
}
}
ContactRespList = zoho.crm.searchRecords("Contacts", "(Mobile:equals:" + fromNumber + ")");
for each ContactResp in ContactRespList
{
FinalId = ContactResp.get("id");
if ((FinalId == null) || (FinalId == ""))
{
FinalId = "";
}
}
updateMap = { ("twilioext.Incoming_Message_Content") : messageContent, "twilioext.SMS_Texts_Name" : ("Incoming SMS"), "twilioext.Lead" : LeadId, "twilioext.Contact" : FinalId, "twilioext.Direction" : "Inbound" };
m = map();
l = List();
l.add(updateMap);
m.put("module", "twilio.SMS_Texts");
m.put("data", l);
resp = zoho.crm.invokeConnector("crm.create", m);
signalleadResp = zoho.crm.getRecordById("Leads", LeadId.toLong());
Leademail = signalleadResp.get("Email");
if ((Leademail != "") || (Leademail != null))
{
signalMap = map();
signalMap.put("signal_namespace", ("twilioext.incomingsmssignal"));
signalMap.put("email", Leademail);
signalMap.put("subject", ("Incoming SMS"));
signalMap.put("message", messageContent);
actionsList = List();
actionMap = map();
actionMap.put("type", "link");
actionMap.put("display_name", "View Email");
actionMap.put("url", "www.google.com");
actionsList.add(actionMap);
signalMap.put("actions", actionsList);
result = zoho.crm.invokeConnector("raisesignal", signalMap);
info result;
}
signalcontactResp = zoho.crm.getRecordById("Contacts", FinalId.toLong());
Contactemail = signalcontactResp.get("Email");
if ((Contactemail != "") || (Contactemail != null))
{
signalMapx = map();
signalMapx.put("signal_namespace", ("twilioext.incomingsmssignal"));
signalMapx.put("email", Contactemail);
signalMapx.put("subject", ("Incoming SMS"));
signalMapx.put("message", messageContent);
actionsListx = List();
actionMapx = map();
actionMapx.put("type", "link");
actionMapx.put("display_name", "View Email");
actionMapx.put("url", "www.google.com");
actionsListx.add(actionMapx);
signalMapx.put("actions", actionsListx);
resultx = zoho.crm.invokeConnector("raisesignal", signalMapx);
info resultx;
}

Comparison of Version 2.0 and 1.0

 Version 1.0Version 2.0
Authentication MethodAPI KeyAPI Key
URL Patternhttps://platform.zoho.com/crm/v2/
settings/custom_functions/
{api_name_of_function}/
execute?zapikey="+zapikey;
https://crm.zoho.com/crm/v2/
functions/{api_name_of_function}/actions/
execute?auth_type=apikey&zapikey={zapikey}
Return Typevoid
The user can't return anything in the function.
String
The user can define how the response of the API is going to be. If the user wants to display or get a particular response code as the response of the function, they can specify it within the function. Besides status codes, the user can also choose to get the response in a specific file type, such as a JSON, HTML, Text, etc.
Request ObjectType : map
Name : requestMap
Type : map
Name : crmAPIRequest
Request Parameters
  • parameters
  • tp_event_response
  • fileContent
  • body
  • params
  • file_content
  • user_info
  • method
  • auth_type
  • headers
Changing the response of the API (using return type)Not supported/**
Your Business Logic here
**/
response = Map();
// to override the status code to 204.
response.put("status_code",204);
return {"crmAPIResponse":response};
Response{
"status_code": 200,
"response": "{\"result\":\"success\",\"info\":[<user given info message>]}"
}
{
"code": "success",
"details": {
"output": "",
"output_type": "string",
"id": "103353000000065018"
},
"message": "function executed successfully"
}

Invoke REST API functions from widgets

You can invoke a REST API function from a widget using the ZOHO.CRM.FUNCTIONS.execute() function. Using this function, you can pass user input values to the REST API function.

The API name of the function can be obtained from the Sandbox URL or Production URL (see below) that can be viewed by clicking Invoke as REST API in the function's deluge script editor.

https://platform.zoho.com/crm/v2/functions/function_apiname/actions/execute?auth_type=apikey&zapikey=​<zapikey>

var func_name = "<function_apiname>";

//obtain user inputs
var lastName = $("#last-name").val();
var company = $("#company").val();

var req_data ={
"arguments": JSON.stringify({
"Last_Name" : lastName,
"Company" : company
})
};
ZOHO.CRM.FUNCTIONS.execute(func_name, req_data)
.then(function(data){
       
})

Given below is the code snippet for the REST API function. Here, the user inputs from the widget is obtained through the params argument.

// to get the parameters of the request
params = crmAPIRequest.get("params");
// to fetch the parameters from the arguments key
args = params.get("arguments");
/**
Your Business Logic here
**/
return <function_response>;