使用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 不接受我的數組作為數組嗎?
1 回答

胡說叔叔
TA貢獻1804條經驗 獲得超8個贊
它應該看起來像這樣
marketing_permissions: [
{
'marketing_permission_id': '123123',
'enabled': true
}
]
有趣的是,要獲取您的 marketing_permission_id,您需要通過 API 訂閱列表并檢查響應,將會有這個唯一的 id
- 1 回答
- 0 關注
- 133 瀏覽
添加回答
舉報
0/150
提交
取消