VTAP blog feature image

Getting Started with VTAP API Designer – Part 2

Previously, in our Vtiger Application Platform (VTAP) blog series, we discussed how to customize the Vtiger interface and bring in custom buttons and widgets to cater to specific business needs. This is just one capability that the platform offers. VTAP empowers you with many such features that help you:
  • Create a custom REST API
  • Connect to other applications that have REST API available
  • Connect to OAuth enabled applications
In this blog, I will discuss how we can create a custom REST API. First, let me talk a little bit about Vtiger REST APIs. It can be accessed with the below endpoint, which will be specific to your CRM instance.
For Example,https://your_instance.odx.vtiger.com/restapi/v1/vtiger/default If you are aware of the Vtiger Rest API, then you can skip the section below. To know about accessible modules, you can use the listtypes API. Here is a screenshot of how you can access the API using the postman client.

listtypes API

Vtiger already provides a standard set of APIs, but with the new API Designer tool, you can now write your very own custom REST APIs.

API Designer
The API Designer provides a workbench for developers to develop HTTP-based APIs that can be exposed to the VTAP Javascript APIs or the external application for easy integration. APIs can be defined using VADL specifications. API access needs user authorization and follows standard record access configuration made within the CRM. The API Designer provides IDE to write custom APIs. If you write a custom REST API for a particular module, you need to name the API and select the module.
Sub-image-2
We have defined Vtiger Application Definition Language (VADL), which is based on XML syntax to enable novice administrators or developers to define API without programming expertise. VADL allows you to:
  • Define CURD
    • APIs (Create, Update, Retrieve, Delete) on entity modules
    • Invoke HTTP based (REST / SOAP) endpoint through (GET/POST/PUT/DELETE) methods
      • With Authentication (Basic / Bearer token-based)
    • Accept request parameters and bind as API inputs

Let’s take an example of creating a custom REST API that will search for Contacts matching the email domain. We will add a new API with the name ‘fetch_email_contact’ and select the Contacts module

Code-sub-image-1

All the definitions are placed inside an API node with standard HTTP type (get, post, put, and delete). Since we are fetching data from CRM, we will use select nodes and pass module names. We will have fields that need to be fetched inside the records node and any filter conditions inside the where node. We support different types of conditions like equal, not equals, like, greater than, less than, etc.
Above is a simple example, which can also be achieved using the existing query REST API.The real power becomes apparent when you combine multiple APIs into one.
Consider this example. You update a record if it exists or create one if it does not exist. If you use an existing API, it will need multiple calls to perform these operations. But when you use the API Designer, you can combine these operations into a single API call.

Code-sub-image-2

In the above example, we are placing the definition inside the upsert node. This comprises the update and create node, which will update a record if it exists or create a record if it does not exist. To identify the record that needs to be updated, you can use the where to filter and find relevant entries. At the end of the definition, the return node will send back defined fields to the client. You can save and publish these APIs to make them available for external applications as well as internal VTAP Javascript.

Accessing a custom API published through the API Designer
  • To access any custom API published through API Designer, you will need to use the below endpoint.
  • https://your_instance.odx.vtiger.com/restapi/vtap/api/API_NAME?PARAMETERS
  • API_NAME should be replaced with the name given to the API. Also, ensure you are using the appropriate HTTP type and credentials(username and access key) to access it.
Accessing a recently created fetch_email_contact API using postman
  • To access a recently created fetch_email_contact API using postman, you should use the below.
  • https://your_instance.odx.vtiger.com/restapi/vtap/api/fetch_email_contact?domain=%vtiger.com%
Note : https://your_instance.odx.vtiger.com/restapi/v1/ApiDesigner/api/fetch_email_contact?domain=%vtiger.com% is deprecated.
Sub-image-3 (1)

These APIs can be accessed internally in Module Designer using VTAP Javascript API VTAP.CustomApi.Get to display inside a widget or custom pages in the Vtiger user interface.

Code-sub-image-3

To conclude, we saw how the API Designer tool allows you to write custom REST APIs and use them internally and in other applications to consume CRM data seamlessly. For any other queries, please send an email to [email protected] Sign up for the developer edition here.

Tags: , , , , , , , ,

Google Calendar Integration Blog Banner

Create Events Smartly and Stay Alerted with Vtiger Google Calendar Integration

Hello Folks! Welcome back to Boost Productivity with Google Workspace Integration blog series. We are coming towards the end of this integration series with only a ...
Booster Pack - banner image

Expand your Pilot Edition Capabilities with Vtiger Booster Packs

Up the ante! You are right - that’s what we said. Vtiger CRM is putting the power in your hands. Pick and choose the feature limits ...
Google Maps integration with vtiger blog banner

Find the Quickest way to reach Client Location with Google Maps and Vtiger CRM Integration

Hello Folks! Welcome back to Boost Productivity with Google Workspace Integration blog series. We appreciate your patience for being loyal and committed to our integration ...
Building an Effective Team

8 Techniques for Building an Effective Team

“Coming together is the beginning. Keeping together is progress. Working together is success.” - Henry Ford. The above quote beautifully describes the importance of working ...
Office outfit blog banner

9 Reasons Why You Should Dress Well For Work

Do you get confused and stressed when choosing your work outfit? You have probably heard multiple times how important it is to dress appropriately for ...
Vtiger + Google Drive Integration Banner

Upload and link Documents Smartly with Google Drive and Vtiger CRM Integration

Hello Folks! Welcome back to Boost productivity with Google Workspace integration blog series. We hope you are able to gain knowledge about Google Workspace integration ...
Overcoming Challenges in the Workplace 2

6 ways of Overcoming Challenges in the Workplace

John T talks about the challenges he faced in his first job and how he overcame them. 'In one of my first job roles, I ...
Google meet Integration 1

Leverage Google Meet Integration with Vtiger CRM to Share Meeting Links Instantly from Different Modules

Hello Folks! Welcome back to Boost productivity with Google Workspace integration series. In this blog, we will be discussing the features and benefits of integrating ...
Vtiger + Google Contacts Integration

Export and Import data Seamlessly with Google Contacts and Vtiger CRM Integration

Hello Folks! Hope you have been following our Boost productivity with Google Workspace integration series. The previous two blogs were about Google Workspace integration and ...
Gmail Integration 3

Get a 360-Degree Customer view from Gmail Integration with Vtiger CRM

Hello Folks! Welcome back to Boost Productivity with the Google Workspace integration series. Hope you have read the previous blog which gives you a glimpse of ...
loading
Copyright 2022 Vtiger | Privacy | Policy & Legal Center