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.
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:
|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.
|Method||This tells what is the type of request, like get, post, put or delete. Default is get type.||method||
|Header parameters||There can be many headers which notifies the target app about the details of the request.||headers||
|Authentication parameters||This will tell which type of authentication are used, like basic auth or bearer token, or oauth.||auth||
|Query parameters||Additional data needed for the request endpoint to perform required action.||parameters||
|Raw json||send parameters as json||raw-post-data||
<?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.
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.