我无法使用API添加地址。我设法更新所有其他列类型,但没有更新地址类型。
我尝试了两种方法:
$array['ADDRESS']['addr1'] = 'Amara Locks 12588'
...
没有用。我收到错误消息:
400: The resource submitted could not be validated. For field-specific details, see the 'errors' array.
由于这个post,我认为我需要将其转换为JSON。它的工作原理是没有出现任何错误,但该字段地址在MailChimp中保持为空。
举个例子,数组的样子:
["ADDRESS"]=>
string(124) "{"country":"DE","addr1":"Amara Locks 12588","addr2":"Second Floor","state":"North Dakota","city":"East Kadin","zip":"33183"}"
答案 0 :(得分:0)
因此,对于将来的读者。是的,第一种方法是正确的方法。但是我的问题是某些值是空的,因此您需要删除它们,例如
$array['ADDRESS']['addr1'] = $address ?? '';
答案 1 :(得分:0)
@Philipp Mochine answer is correct.This answer is for all those PHP developer who are
looking for complete array structure.
array:2 [
"email_address" => "ggdd@gmail.com"
"merge_fields" => array:4 [
"FNAME" => "Hassan"
"LNAME" => "Tahir"
"PHONE" => ""
"ADDRESS" => array:6 [
"addr1" => "81 street"
"addr2" => "house no 2"
"city" => "Lahore"
"state" => "Punjab"
"zip" => "54000"
"country" => "Pakistan"
]]
]