Home  >   VTAP Platform   >  VTAP Tables

VTAP Tables

V
Vikas Kumar
6 Jun, 2023 - Updated 10 months ago
Table of Contents

Introduction

 

VTAP Tables allows you to create, update, delete tables just like any sql table. You can add data, update, delete data to these tables and use them just like spreadsheets. Generally you would use these tables when you have light data, which does not need permission checks or each row does not need an owner. You can use these Tables with Insights Designers and visualize the data in different types of charts, and pivot tables. You can embed apps built on VTAP into the CRM iframe.

 

You can use these tables to store data for many use cases like:

  • Store data coming from other applications.
  • Push crm data, like log data or user specific data.​​​​​​
 

Technical Limits

  • Every account can have a maximum of 100 tables.
  • Every table can have a maximum of 100,000 rows
  • Every table can have a maximum of 50 columns.


VTAP Tables can be accessed from our REST API’s as well as VTAP Javascript API’s which are explained below.
 

 REST API’s

You can use REST API calls to perform CRUD actions on the VTAP Tables.
 

Authentication

VTAP Tables uses basic authentication to access the resources. You need to pass Vtiger Username as username and Accesskey(available in User My preference) as Password.

 

End points

Below are the endpoints which will let you create tables and access its data.

  • Get all VTAP Tables
    • URL - restapi/vtap/tables
    • Method - GET
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Request

       

curl --location --request GET 'https://xxx.od2x.vtiger.com/restapi/vtap/tables' \
--header 'Authorization: Basic YWRtaW5AYWRtaW4uY29tOmFHWGJqY3hhNlNMQm9EanQ='

  • Response format

{
  "success": true,
  "result": [
      {
          "id": "31",
          "name": "sales",
          "label": "Forecast Sales",
          "columns": [
              {
                  "id": "57",
                  "name": "owner",
                  "label": "Owner",
                  "type": "number",
                  "options": "null"
              },{
                  "id": "58",
                  "name": "saledate",
                  "label": "Sale Date",
                  "type": "date",
                  "options": "null"
              },{
                  "id": "59",
                  "name": "amount",
                  "label": "Amount",
                  "type": "decimal",
                  "options": "null"
              },{
                  "id": "60",
                  "name": "location",
                  "label": "Location",
                  "type": "string",
                  "options": "null"
              }
          ]
      }
  ]
}





 
  • Create VTAP Table
    • URL - restapi/vtap/tables
    • Method - POST
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the table, only alphabets and numbers are accepted and starting with alphabets only.
      •  label - Table display name
      • columns - array of columns of the table with name, label and type. Supported types of the columns are:
        • string - string length 255 
        • text - string length 64k 
        • number - max value 2147483647 
        • decimal - 20 integers and 8 decimal 
        • boolean - 0/1
        • date 
        • datetime
        • richtext - 64MB
           
    • Request
 

curl --location --request POST 'https://xxx.od2x.vtiger.com/restapi/vtap/tables \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'name=sales' \
--data-urlencode 'label=Forecast Sales' \
--data-urlencode 'columns=[{"name":"product","label":"Product name","type":"text"},{"name":"salesdate","label":"Sale Date","type":"date"}]'

 
  • Update VTAP Table
    • URL - restapi/vtap/tables
    • Method - PUT
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      •  label - Table display name, if you want to change
      • columns - array of columns of the table with name, label and type. If you want to remove a column then pass “remove” as true. If column name does not exist then it will create else it will update.
    • Request

curl --location -g --request PUT 'https://xxx.od2x.vtiger.com/restapi/vtap/tables?name=sales&label=Sales Data&columns=[{"name":"saledate","label":"sales","type":"datetime"},{"name":"amount","remove":true}]' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'

 
  • Delete VTAP Table
    • URL - restapi/vtap/tables
    • Method - DELETE
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
    • Request

curl --location -g --request DELETE 'https://xxx.od2x.vtiger.com/restapi/vtap/tables?name=sales' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'

 
  • Add data to VTAP Table
    • URL - restapi/vtap/tables/TABLENAME
    • Method - POST
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      • values - array of the data to be added to the table
    • Request

curl --location --request POST 'https://xxx.od2x.vtiger.com/restapi/vtap/tables/edition/import' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'name=sales' \
--data-urlencode 'values=[{"userid":1,"saledate":"2022-11-11"},{"userid":2,"saledate":"2022-10-10"},{"userid":1,"saledate":"2022-11-11"},{"userid":2,"saledate":"2022-10-10"},{"userid":1,"saledate":"2022-11-11"},{"userid":2,"saledate":"2022-10-10"}]'



 
  • Import csv file to VTAP Table
    • URL - restapi/vtap/tables/TABLENAME
    • Method - POST
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      • filename - csv file having headers with column name of the tables 
    • Request

curl --location --request POST 'https://xxx.od2x.vtiger.com/restapi/vtap/tables/edition/import' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'
--form 'filename=@"/home/user/edition.csv"'



 
  • Get data from VTAP Table
    • URL - restapi/vtap/tables/TABLENAME
    • Method - GET
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      • page - page number, per page limit is 1000
    • Request

curl --location --request GET 'https://xxx.od2x.vtiger.com/restapi/vtap/tables/sales?page=2' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'




 
  • Update data to VTAP Table
    • URL - restapi/vtap/tables/TABLENAME
    • Method - PUT
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      • values - array of the data to be added to the table, each row should have an id that is returned when adding data to the table.
    • Request

curl --location -g --request PUT 'https://xxx.od2x.vtiger.com/restapi/vtap/tables/sales?values=[{"id":"36","userid":"2"},{"id":"37","saledate":"2023-01-15 12:15:00"}]' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'



 
  • Delete data to VTAP Table
    • URL - restapi/vtap/tables/TABLENAME
    • Method - DELETE
    • Header - Basic Authentication (Vtiger Username + Access key)
    • Parameters
      • name - name of the existing table.
      • values - array of the row ids
    • Request

curl --location -g --request DELETE 'https://xxx.od2x.vtiger.com/restapi/vtap/tables/sales?values=[34,35]' \
--header 'Authorization: Basic CRM_USER_NAME:ACCESSKEY'




 

Javascript API

 

You can use VTAP Javascript api’s to perform CRUD operation on tables schema as well as data. All the javascript functions return a promise to wait and process the data. 

 
  • VTAP.Tables.Get - To get all the VTAP Tables available in the account
     

VTAP.Tables.Get().then((tables) => {
    //tables is an array
}) 

 
  • VTAP.Tables.Create(name, label, columns) - To add a new VTAP Table.
    • Parameters
      • name - name of the table
      • label - label of the table
      • columns - columns of the table

VTAP.Tables.Create(
"log",

"Click logs", [{"name":"user","label":"User","type":"number"},{"name":"event","label":"Event","type":"string"}])

.then((tableInfo) => {
    console.log(tableInfo);
})

 

 
  • VTAP.Tables.Put(name, label, columns) - To update an existing VTAP Table label and columns.
    • Parameters
      • name - name of the table
      • label - label of the table
      • columns - columns of the table

VTAP.Tables.Update(
"log",
"Click logs", [{"name":"event","label":"Event","type":"largestring"}])
.then((tableInfo) => {
    console.log(tableInfo);
}) 



 
  • VTAP.Tables.Delete(name) - To delete an existing VTAP Table rows.
 

VTAP.Tables.Delete("log").then((tableInfo) => {
    console.log(tableInfo);
}) 

 

API CRUD operations on VTAP Tables and their details are below:

 
  • VTAP.TablesData.Get(name, page) - To fetch data from the VTAP Tables

VTAP.TablesData.Get("log").then((response) => {
    console.log(response);
});

 
  • VTAP.TablesData.Create(name, rows) - To add data to existing VTAP Tables

VTAP.TablesData.Create("log",[{"user":"2","event":"demo page clicked"},{"user":"3","event":"sign up clicked"}])
.then((response) => {
    console.log(response);
});

 
  • VTAP.TablesData.Import(name, file) - To import csv file to existing VTAP Tables
     

upload(event) {
    Let files = event.target.files || event.dataTransfer.files;
    VTAP.TablesData.Import(this.table, files[0]).then((response) => {
                           
    });
}

 
  • VTAP.TablesData.Update(name, rows) - update VTAP tables row data.
 

VTAP.TablesData.Update("log",[{"id":"1","event":"demo page clicked"},{"id":"2","event":"sign up button clicked"}])
.then((response) => {
    console.log(response);
}); 

  • VTAP.TablesData.Delete(name, ids) - delete VTAP table rows.
     

VTAP.TablesData.Delete("log",[1,2]).then((response) => {
    console.log(response);
}); 





 

Was this article helpful?
0  out of  0  found this helpful.
Comments 0
Be the first to comment
© Copyright 2023 Vtiger. All rights reserved.