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. Sub-image-1 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 runtime 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 runtime. 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/V1/ApiDesigner/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/V1/ApiDesigner/api/fetch_email_contact?domain=%vtiger.com%
Sub-image-3 These APIs can be accessed internally in Module Designer using VTAP runtime API VTAP.CustomApi.Get to display inside a widget or custom pages in the Vtiger user interface. Widget image 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 platform@vtiger.com. Sign up for the developer edition here.

Tags: , , , , , , , ,

Leave a Reply

Notify of
Social Facebook

Manage your Facebook Page with Vtiger Social

A few days ago, we introduced you to our brand new Social module[1]. It is a platform within Vtiger CRM that allows you to manage ...
Blog Image - Social Module

Vtiger Social Module: Bring your Social Media Interactions into your CRM

It is no secret that social media now plays a prominent role in helping a company remain competitive in an increasingly digital corporate environment. You ...
List view Action 6 (1)

Big Little Things – List View Actions

Welcome to the first blog in our new miniseries, ‘Big Little Things,’ where we highlight some of the smaller features and enhancements in Vtiger CRM ...
Blog - AB Testing in sales

Making the Most of A/B Testing in Sales

“There is nothing so terrible as activity without insight.” - Johann Wolfgang von Goethe I realize it can be tough to justify putting in the time ...
MS Teams blog feature image

The Road to Superior Teamwork with Microsoft Teams Integration

Switching between apps to get things done will break the continuum of work. Working on records in the CRM and collaborating on other apps simultaneously ...
Image 2

VTAP Module Designer – Our low code platform to make the CRM your own!

VTAP is Vtiger’s low code platform that helps developers and administrators to extend the capabilities of CRM. We have two tools that provide the ability ...
Celebrate success 3

Celebrate your achievements – add confetti to your announcements in the CRM!

This pandemic has taught us many things, one of which is recognizing and encouraging ourselves when we achieve a goal. And the valuable lesson we ...
India Mart blog image

Vtiger-IndiaMART Integration: Manage leads and increase conversions!

Do you know that India is home to more than 1.3 billion people, the second-largest globally in terms of population?  For the unversed, India is a ...
Clearbit blog image

Leverage Vtiger – Clearbit integration to import contact details

Vtiger Cloud is now geared up with the Vtiger Application Platform (VTAP), an enabler that lets businesses build productive in-app customizations to boost CRM capabilities ...
VTAP Extension - blog image

Optimize your CRM using VTAP, Vtiger’s low code platform!

Ways to simplify common and repetitive tasks are always in great demand in order to save time, money, and effort. For example, simple optimization techniques ...
Copyright 2021 Vtiger | Privacy | Policy & Legal Center