Overview of Function API

Overview of Function API

Feature Availability

Overview

Function API in Zoho Connect provides an authenticated API endpoint to establish a connection between two applications and automate workflows. It also includes handlers that let you format the request and response structure of an API to match the requirements of a specific application. 

What is an API?  

An API (Application Programming Interface) is a software intermediary that allows two applications to communicate with each other. APIs are request-based, meaning they are triggered whenever a request is made to the API endpoint and can create, read, update, or delete data based on the request. API is one of the important components for integrating applications to work together. 

What is an API endpoint?  

An API endpoint is a URL of a service to which requests are made to retrieve or access the data required to perform a specific task.  In simple terms, an API endpoint is a touchpoint for communication between two applications. 

What is the usage of Zoho Connect's Function API? 

While integrating applications using APIs, the structure of request from one application must match the requirements of the other application. For example, to integrate the Zoho Connect with MeisterTask or any other task management application for creating the task, it should follow the request and response structure of the Zoho Connect Create Task API. 
 
However, the request and response structure of one application might not usually meet the requirements of the other one. This is where Function API comes into the picture. Using Function API, you can customize the structure of a request to match the requirements of a particular application

Handlers in Function API 

Function API has two handlers: Get request handler and Post request handler. You can write a custom function using Deluge scripts to define how the request needs to be handled or customized by these handlers. Depending on the type of request made, the relevant handler is triggered. 
 
  1. Get request handler
The custom function written in this handler is triggered whenever a GET request is made to the API endpoint. 
Along with network and user details, the request details like headers and parameters are passed to the scope of the custom function as arguments. The below table lists the parameters passed in the GET request handler

Name
Data Type
Description
params
map
Query parameters sent in the request.
headers
map
Headers sent in the request.
network
map
Details of the network to which the request is made.
user
map
User details of the Function API owner.
 
  1. Post request handler
The custom function written in this handler is triggered whenever a POST request is made to the API endpoint. The below table lists the parameters passed in the POST request handler
 
Name
Data Type
Description
params
map
Parameters sent in the request.
headers
map
Headers sent in the request.
body
String
Payload data sent in body of the request.
network
map
Details of the Network to which the request is made.
user
map
Details of the configuration owner.
 
The response of the API can be defined in the custom function as execution response using the attributes in the below table.
 
Name
Data Type
Description
Value
statusCode
HTTP Status code
Status code of the request
Default value: 200 OK
response
String
Response of the API
empty
 
The default value is taken if the custom function response doesn’t  have the above attributes.
 
If you have any questions regarding Function API, please write to us at support@zohoconnect.com. We'll be happy to help!