Calling Functions using REST APIs
A function lets you have additional functionalities and features in your CRM apart from the conventional features. A function needs a trigger to call it. The trigger could be in the form of a workflow, blueprint, related list, or the click of a button.
If the function needs to be triggered without employing these methods or from external sources, you can create standalone functions and make them be available as API calls. Triggering functions through REST APIs gives you the flexibility to trigger them from anywhere inside Zoho CRM or from any third party application.
Sample function as an API call:
A form which automatically generates a lead in your CRM with the information given as input in the form.
Step 1:
Create a standalone function with the following code.
.png)
Note
The arguments to be passed for the above function are "FirstName", "LastName", "Company" and "Mobile". Data type for the arguments is STRING.
Step 2:
To make the function be available as an API,
Go to Setup > Developer Space > Functions.
Hover over the function that needs to be made available as an API to display the Settings icon (three dot icon).
Click REST API
Set the API name for the function.
Enable OAuth2.0 and the API key sliders.
Click Save.
Note
Select OAuth2.0 for sharing the function as an API within your organization.
Select API Key for sharing the function with any third party and enable it to be used by anyone.
Step 3:
The sample here is shown as a form created using Zoho Creator. Create the form such that it has the fields "FirstName", "LastName", "Company" and "Mobile". You can program the function to get executed upon the click of Submit button.

Result:
Once the Submit button is clicked, the function gets executed and a new lead is created in your CRM. The lead has the details which was given within the form.

Functions in Postman
Functions which are given as API calls can be tested using POSTMAN application. However, there are a few things that you need to keep in mind when executing a function in that app.
The current supported methods for using a function as an API are GET and POST.
In a POST request, under the Body section, select form-data.
Create a Key named arguments and the Value as the Input JSON object.
The arguments can also be given in the URL as arguments={encoded_arguments}
POST request - Arguments Limit
In request URL - 5000 lines
In body - 95000 lines (as JSON object)
.png)
Sample arguments in "Body":
{
"First_Name":"Art",
"Last_Name":"Clayton",
"Company":"Zylker",
"Mobile":"555-876-4367"
}
See Also - Associate a function to a Workflow, Button, and Related List.
To test the function integration
Add test data in Zoho CRM according to your workflow rule criteria.
Check for the data received from Zoho CRM via function, in your application.
Modify your function code in Zoho CRM, if data is not received or if there is a data mismatch.
Continue this test until you obtain the required data from Zoho CRM to your application.