我正在尝试进行简单的 JSON 调用以向新的或现有的订阅者添加标签。
它添加订阅者的名字、姓氏和电子邮件地址,但不添加标签。我不确定我做错了什么。
这是我所拥有的:
public function apiUrl() {
$apiKey = $this->Key;
$listId = $this->ListID;
$memberId = $memberId = md5(strtolower($this->Email));
$getapi = substr($this->escape($apiKey), strpos($this->escape($apiKey), '-') + 1);
return 'https://' . $this->escape($getapi) . '.api.mailchimp.com/3.0/lists/' . $this->escape($listId) . '/members/' . $this->escape($memberId);
}
public function jsonData() {
return json_encode(array(
'email_address' => $this->escape($this->Email),
'status' => $this->escape($this->Status),
'tags' => ['name' => 'Calendar Users', 'status' => 'active'],
'merge_fields' => array(
'FNAME' => $this->escape($this->FName),
'LNAME' => $this->escape($this->LName)
)
));
}