我想使用api v2在zoho中插入数据。首先创建一个数组,然后编码json .Request url https://www.zohoapis.com/crm/v2/Contacts。但我犯了个错误。
代码:
$authtoken = ***********;
$fields={"data":["{\"Last_Name\":\"Test John insert\",\"Email\":\"testjhon@jhon.com\"}"]};
$zoho_url = "https://www.zohoapis.com/crm/v2/Contacts";错误:
{"data":[{"code":"INVALID_DATA","details":{"expected_data_type":"jsonobject","index":0},"message":"invalid data","status":"error"}]}发布于 2019-02-28 08:16:17
工作实例:
$fields = json_encode(
array(
"data" => array([
"Company" => "abc",
"Last_Name" => "Tom",
"City" => "Egham"
],
[
"Company" => "abc",
"Last_Name" => "Jerry",
"City" => "Egham"
])
)
);以这种方式发送标头:
$headers = array(
'Content-Type: application/json',
'Content-Length: ' . strlen($fields),
sprintf('Authorization: Zoho-oauthtoken %s', $oauth)
);发布于 2018-07-02 10:43:33
使用这个json数组:
$fields = "{\"data\":[{\"Last_Name\": \"Test\",\"First_Name\": \"TESTING\",\"Email\": \"demo@w3scloud.com\"}],\"trigger\":[\"approval\",\"workflow\"]}";发布于 2018-07-26 12:53:48
以这种方式发送:
[{ "data": \[ { "Company":"company name", "Last_Name":"your last name", "Phone":"123456789", "First_Name": "your first name", "Email":"first@gmail.com" } \], “triggger”:\[“workflow”,”approval”,”blueprint”\] }]希望这能帮到你。
https://stackoverflow.com/questions/50980779
复制相似问题