我试图从角度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相同,但没有任何作用
答案 0 :(得分: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,执行操作的权限被拒绝“}}
答案 1 :(得分:0)
此错误消息可能是由于:
See here示例(在PHP中)如何传递对象以执行更新