How to Create custom operation for Webservice VtigerCRM?

纵然是瞬间 提交于 2019-12-21 02:54:46

问题


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?


回答1:


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;
}?>



回答2:


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



来源:https://stackoverflow.com/questions/38931706/how-to-create-custom-operation-for-webservice-vtigercrm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!