我想使用 API v3 创建一个作为子组的子组,但我不确定如何在请求中设置条件。由于某种原因,我今天不能去操场,所以我不能玩它。
我在想类似的事情:
function createSegment($apikey, $dc, $list_id, $name) {
$data = array(
"name"=> $name,
**CONDITION**
);
$data = json_encode($data); // API requires JSON objects
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://".$dc.".api.mailchimp.com/3.0/lists/".$list_id."/segments");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true); // declare request is POST type
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // set POST data
curl_setopt($ch, CURLOPT_USERPWD, "user:".$apikey); // HTML Basic Auth
$output = curl_exec($ch); // execute and capture response
curl_close($ch);
}