In the REST API topic you saw how to build APIs to access CRM data, but in the real world an organization uses hundreds of applications for their employees and data is spread across them. Very often there is need to either sync the data with other applications or bring/send some parts of data to/from CRM.
Connecting to other applications that has REST APIs exposed has become easy with VTAP platform now, you can use API Designer, build an API, connect to them using Javascript APIs and display them on a widget inside Vtiger or post data to the other application.
These outbound REST APIs allow you to create, update, read or delete data on an application that supports REST architecture.
To build any REST APIs you need to use VADL which provides xml nodes, we have used them to build custom CRM data APIs.
Rest API compromises of below parts:
Name | Description | VADL equivalent | Example |
---|---|---|---|
Endpoint | This is used to connect the application where the data resides. For dynamic parts of the url pass them as attributes in the url xml as shown in example 2. | url | 1. <url>https://example.com/api/v1/get_contacts</url> 2. <url SHEETID="@sheetid" OPTIONS="values/Sheet1!A1:append?valueInputOption=RAW">https://sheets.googleapis.com/v4/spreadsheets/$SHEETID/$OPTIONS</url> |
Method | This tells what is the type of request, like get, post, put or delete. Default is get type. | method | <api method="post"> </api> |
Header parameters | There can be many headers which notifies the target app about the details of the request. | headers | <headers><header name="content-type" value="application/json"></header></headers> |
Authentication parameters | This will tell which type of authentication are used, like basic auth or bearer token, or oauth. | auth | <auth><basic username="" password=""></basic></auth> |
Query parameters | Additional data needed for the request endpoint to perform required action. | parameters | <parameters><parameter name="id" value="@id"></parameter></parameters> |
Raw json | send parameters as json | raw-post-data | <parameters raw-post-data="true"><parameter name="id" value="@id"></parameter></parameters> |
<?xml version="1.0"?>
<api method="post">
<rest method="post">
<url id="@id"> https://example/api/v1/get/$id </url>
<headers>
< header> name="" value=" "</headers>
</headers>
<auth>
<basic username="" password=""> </basic>
</auth>
<parameters>
<parameter name="id" value="@id"> </parameter>
</parameters>
</rest>
</api>
<?xml version="1.0"?>
<api method="post">
<rest method="post">
<url>https://httpbin.org/anything</url>
<headers>
<header name="Content-Type" value="application/json"></header>
</headers>
<parameters raw-post-data="true">
<parameter name='identifier' value='@identifier'></parameter>
<parameter name='managerId' value='@managerId'></parameter>
<parameter name='managerName' value='@managerName'></parameter>
</parameters>
</rest>
</api>
We will add documentation on this soon, in the mean while you can watch this webinar video on our youtube channel.
coming soon..
To connect to any external application the adminstrator has to whitelist the domain, before you can start calling the API. For this you need to go to Apps > Platform > Api Designer, on the top right side we have provided Settings icon. Click on it to see Api Settings, here you can select the module for which you are building the API and add the external domain which can be used in building API.
Yes, you can build GET, POST, PUT or DELETE type of request. When building api using VADL, inside api xml node you need to pass type attribute with one of the above values.