Commit 30269b48 authored by Vikas's avatar Vikas

updated link to wiki pages

parent da5b1909
# VTAP
ApiDesignerExamples folder has examples for custom REST API's or invoke other application HTTP end points.
**Note** :
1. For external applications you need to white list them. This can be added from API Designer list view > Settings.
2. Unique names should be given for each api's so they can be identifed easily.
**VADL** : Defining API's are dependent on VADL (Vtiger Api Definition Language). This language is loosely based on xml format.
VADL provides following options to create api's.
1. api - all the api's are defined within this node. It has attribute method which decides the http type of api request.
Example :
<?xml version="1.0" ?>
<api method="get">
//API definition
</api>
2. select - used to select vtiger records.
Example :
* Select module records with where condition
<?xml version="1.0" ?>
<api method="get">
<select module="Contacts">
<record>
<field name="firstname"> </field>
<field name="lastname"> </field>
</record>
<where>
<field name="email" value="[email protected]"> </field>
</where>
</select>
</api>
* Select module with value binding
<?xml version="1.0" ?>
<api method="get">
<select module="Contacts">
<record>
<field name="firstname"> </field>
<field name="lastname"> </field>
</record>
<where>
<field name="email" value="@email_address"> </field>
</where>
</select>
</api>
3. create - create vtiger record by passing request parameters and respond back with response defined by fields.
Example :
* Create Contacts with value binding
<?xml version="1.0" ?>
<create module=”Contacts”>
<record>
<field name="firstname" value="@firstname"></field>
<field name="lastname" value="@lastname"></field>
<field name="email" value="@email"></field>
</record>
<return>
<field name="id"></field>
<field name="firstname"></field>
<field name="lastname"></field>
<field name="email"></field>
<field name="assigned_user_id"></field>
</return>
</create>
* Create Potential with reference field
<?xml version="1.0" ?>
<api method="post">
<create module=”Potentials”>
<record>
<field name="potentialname" value="@name"></field>
<field name="amount" value="@amount"></field>
<field name="contact_id" module="Contacts">
<select>
<where>
<field name="email" value="@email"></field>
</where>
</select>
<create>
<record>
<field name="lastname" value="@lastname"></field>
<field name="firstname" value="@firstname"></field>
<field name="email" value="@email"></field>
<field name="contacttype" value="Lead"></field>
</record>
</create>
</field>
</record>
</create>
</api>
4. update - it will update existing vtiger record.
Example :
* Update contacts using email address field.
<?xml version="1.0" ?>
<api method="put">
<update module="Contacts">
<record>
<field name="email" value="@email"></field>
</record>
<return>
<field name="id"></field>
</return>
<where>
<field name="email" condition="eq" value="@old_email"></field>
</where>
</update>
</api>
5. upsert - update if record found else create new record.
Example :
* Search a contact by id, if found update else create new contact.
<?xml version="1.0" ?>
<api method="post" module=”Contacts”>
<upsert>
<where>
<field name="id" condition="eq" value="@CRMID"></field>
</where>
<update>
<record>
<field name="email" value="@email" presence="optional" ></field>
</record>
</update>
<create>
<record>
<field name="firstname" value="@firstname" presence="optional" ></field>
<field name="lastname" value="@lastname" presence="optional" ></field>
<field name="email" value="@email" presence="optional" ></field>
</record>
</create>
<return>
<field name="id"></field>
</return>
</upsert>
</api>
6. delete - this will delete vtiger record
Example :
* Delete records
<?xml version="1.0" ?>
<api method="delete">
<delete module="@module">
<where>
<field name="id" condition="eq" value="@CRMID"></field>
</where>
</delete>
</api>
For documentation refer our [wiki](https://extend.vtiger.com/vtap/documentation/wikis/API-Designer) section
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment