Php 使用Guzzle和GetResponse API保存自定义字段?
我正在向GetResponse API发送post请求。在我添加一个自定义字段(customFieldValues)与新的电子邮件联系人一起保存之前,一切正常Php 使用Guzzle和GetResponse API保存自定义字段?,php,api,getresponse,Php,Api,Getresponse,我正在向GetResponse API发送post请求。在我添加一个自定义字段(customFieldValues)与新的电子邮件联系人一起保存之前,一切正常 $body_data = [ 'name' => $input['name'], 'email' => $input['email'], 'campaign' => [
$body_data =
[
'name' => $input['name'],
'email' => $input['email'],
'campaign' => [
'campaignId' => $campaign_id
],
'customFieldValues' => ['customFieldId' => 'LDe0h', 'value' => ['Save this test string.'] ]
];
发送请求时,我收到以下错误消息:
"errorDescription": "CustomFieldValue entry must be specified as array"
我现在已经尝试了一些方法,但不确定如何正确格式化以使API接受它
参考链接:
我在github的php api示例中找到了解决方案: 我想我必须把一个数组封装在一个数组中的一个数组中…天哪:
'customFieldValues' => array(
array('customFieldId' => 'custom_field_id_obtained_by_API',
'value' => array(
'Y'
)),
array('customFieldId' => 'custom_field_id_obtained_by_API',
'value' => array(
'Y'
))
)