【问题标题】:vTiger webservice update operationvTiger webservice 更新操作
【发布时间】:2016-11-15 13:43:24
【问题描述】:

我试图从角度 2 进行更新操作,但我不知道如何传递元素参数

在 vtigercrm.log 我看到 DEBUG webservice -

array ('element' => NULL)

导致这个

"error": {
"code": "ACCESS_DENIED",
"message": "Permission to perform the operation is denied for id",

我尝试将以下对象作为 JSON 传递

{
"subject":"test2",
"assigned_user_id":"19x1",
"date_start":"2016-11-15",
"time_start":"12:00:00",
"due_date":"2016-11-15",
"time_end":"14:00:00",
"recurringtype":"",
"duration_hours":"2",
"duration_minutes":"0",
"parent_id":"",
"eventstatus":"Planned",
"sendnotification":"0",
"activitytype":"Call",
"location":"",
"createdtime":"2016-11-15 11:31:19",
"modifiedtime":"2016-11-15 11:31:19",
"taskpriority":"",
"notime":"0",
"visibility":"Public",
"modifiedby":"19x1",
"description":"",
"reminder_time":"",
"contact_id":"",
"latitud":"",
"longitud":"",
"id":"18x22029"
}

与 encodeURI 和 encodeURIComponent 相同,但没有任何作用

【问题讨论】:

    标签: api vtiger


    【解决方案1】:

    我遇到了类似的错误,我发现 JSON 中存在细微差别。返回结果时,json 对象是数组中的第一个元素。但是对于发送,它需要只是对象,而不是数组。

    <?php
    
    //decode the json encode response from the server.
    $jsonResponse = json_decode( $response->getBody(), true );
    
    //Get first array element for sending back with update			
    $objectJson = json_encode($jsonResponse[ 'result' ][0]);
    				
    ?>

    每当我尝试发送原始响应时,都会收到错误消息:{"success":false,"error":{"code":"ACCESS_DENIED","message":"id 拒绝执行操作的权限"}}

    【讨论】:

      【解决方案2】:

      此错误消息可能是由于:

      1. 在您作为参数“元素”发送的 JSON 对象中未提及/正确的对象 ID
      2. 参数“sessionName”中未发送/更正 Vtiger 会话 ID

      See here 一个如何传递对象以执行更新的示例(在 PHP 中)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-21
        相关资源
        最近更新 更多