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 platform@vtiger.com. Sign up for the developer edition here.

Tags: , , , , , , , ,

deal-room-blog-banner@2x

This Room is a Big Deal

We are constantly looking to help companies improve their customer experience (CX) here at Vtiger. Our CRM platform is optimized for all stakeholders within the ...
Big Little Things Banner 2-04

Big Little Things – Tags

Welcome back to the blog series Big Little Things, where we highlight some of the lesser-known and sometimes overlooked features and enhancements in Vtiger CRM ...
Vtiger lite (1)

Use Vtiger CRM mobile app to stay on top of your business

Does your profession involve traveling a lot? Well, work doesn’t have to stop if you are traveling. Or, if you don’t have a computer and ...
Title Image 1

Boost customer interactions. Engage with your Twitter & Instagram audiences directly from the CRM.

We spend more time online than ever before - in 2020, we spent a whopping 16 trillion hours on our mobiles! * And about 48% ...
Blog - Project Management

Fundamentals of Project Management

Are you an individual trying to understand your role in a project? Or perhaps you have been assigned as a project lead out of the ...
Vtiger Video Conferencing Integration

6 Vtiger video conferencing features to power up your collaborations

With businesses providing services globally - remote sales and support are the new normal. The rise of remote work has also driven the demand for ...
Big Little Things 91

Big Little Things – Find Duplicates

Welcome back to Big Little Things, where we highlight some of the lesser-known and sometimes overlooked features and enhancements in Vtiger CRM that pack a ...
Banner

Six benefits of integrating Vtiger CRM with your WhatsApp account

Instant messaging has replaced traditional methods of commercial communication. Customers want businesses to be able to interact with them immediately. Did you know that 63% ...
Landing page blog 2

Boost your lead generation with Vtiger’s Landing Pages feature

The internet is an amazing place to be. It continues to change how we communicate with one another, share knowledge, and live a fulfilling existence ...
Vtiger Aide 5

Multi-task effortlessly with Aide, Vtiger’s virtual assistant

When you are on a client visit, or traveling, or simply having a busy day, there is every chance you might miss out on a ...
loading
Copyright 2021 Vtiger | Privacy | Policy & Legal Center