使用DrewM Mailchimp API PHP 包装器,我尝试 POST 订阅者并marketing_permissions
同时声明该字段的值,但 Mailchimp API 响应坚持认为我为该字段提供的值marketing_permissions
不是数组。
但它肯定是一个数组,如下所示:
$params = [
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => [
'STATUS' => $status,
'FNAME' => $first_name,
'LNAME' => $last_name,
'JOBTITLE' => $title,
'COMPANY' => $company,
'PHONE' => $phone,
'AGENCY' => $agency,
'MESSAGE' => $message
],
'marketing_permissions' => [
[
'marketing_permission_id' => '1234567890',
'enabled' => true
]
]
];
$subscriptionResult = $MailChimp->post('lists/1234567890/members', $params);
我从 MC API 得到的响应是:
Array
(
[type] => http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
[title] => Invalid Resource
[status] => 400
[detail] => The resource submitted could not be validated. For field-specific details, see the 'errors' array.
[errors] => Array
(
[0] => Array
(
[field] => marketing_permissions
[message] => This value should be of type array
)
)
)
有人知道为什么 MC API 不接受我的数组作为数组吗?
胡说叔叔