3

I am new in vtigercrm. I want need a custom operation to get all modules from vtiger_tab table by using webservice.

How do I Create a custom operation for Web service Vtiger CRM?

Michael Benjamin
  • 265,915
  • 79
  • 461
  • 583

2 Answers2

3

To define a new webservice custom method you have to manipolate 2 tables vtiger_ws_operation and vtiger_ws_operation_parameters First declare the mathod name and handler by executing a query like

INSERT INTO `vtiger_ws_operation` ( `name`, `handler_path`, `handler_method`, `type`, `prelogin`) VALUES ('my_webservice_method', 'include/Webservices/MyWebserviceMethod.php', 'vtws_my_webservice_method’, 'GET', 0);

Suppose that the inserted record has the field operationid equals to 34, now you must add parameters to vtiger_ws_operation_parameters with a query like

INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (34, 'id', 'String', 1);

and continue with incremental values for the last field

INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (34, ‘param_99’, 'String', 99);

Due to the first query, now you must create a file named MyWebserviceMethod.php in the folder include/Webservices/ In this file there will be a function called vtws_my_webservice_method like this

<?php

function vtws_my_webservice_method($id, $user){

    global $log,$adb;
    …..
    return $something;
}?>
0

Vtiger by default provides an operation "listtypes" to get list of available modules in vtiger based on User passed in API. If you wanted to create custom API then of course you can create but you to take care about sharing privileges for modules like which user has what access in each module.

You can refer this link to create custom Web-service. But that is also not having full information. I will share if i will get more clear document for you.

https://discussions.vtiger.com/index.php?p=/discussion/28575/howto-create-a-custom-webservice-getpdfdata/p1

Milan Malani
  • 1,679
  • 1
  • 19
  • 33