如何为Webservice VtigerCRM创建自定义操作?

时间:2016-08-13 10:20:30

标签: vtiger vtigercrm

我是vtigercrm的新手。我想要一个自定义操作来使用webservice从 vtiger_tab 表中获取所有模块。

如何为Web服务Vtiger CRM创建自定义操作?

2 个答案:

答案 0 :(得分:3)

要定义新的Web服务自定义方法,您必须操作2个表vtiger_ws_operation和vtiger_ws_operation_parameters 首先通过执行类似

的查询来声明mathod名称和处理程序
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);

假设插入的记录的字段operationid等于34,现在必须使用类似

的查询向vtiger_ws_operation_parameters添加参数
INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (34, 'id', 'String', 1);

并继续使用最后一个字段的增量值

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

由于第一个查询,现在您必须在文件夹include / Webservices /中创建名为MyWebserviceMethod.php的文件 在这个文件中将有一个名为vtws_my_webservice_method的函数,就像这个

<?php

function vtws_my_webservice_method($id, $user){

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

答案 1 :(得分:0)

Vtiger默认提供操作“ listtypes ”,以根据用户传入的API获取vtiger中的可用模块列表。如果你想创建自定义API,那么你当然可以创建,但是你需要注意模块的共享权限,比如用户在每个模块中都有访问权限。

您可以参考此链接来创建自定义Web服务。但这也没有完整的信息。如果我能为您提供更清晰的文件,我将分享。

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

相关问题