【发布时间】:2019-03-19 10:34:45
【问题描述】:
需要使用我所拥有的 list_id 获取campaign_id。我的目标是获取所有广告系列数据,然后使用 list_id 进行排序。我已经能够检索活动响应正文,但不知何故未能获取活动 list_id。任何帮助或不同的方法将不胜感激。分享我的代码和mailchimp api相关参考。
MailChimp api 参考:
"campaigns": [
{
"id": "42694e9e57",
"type": "regular",
"create_time": "2015-09-15T14:40:36+00:00",
"archive_url": "http://",
"status": "save",
"emails_sent": 0,
"send_time": "",
"content_type": "template",
"recipients": {
"list_id": "57afe96172", // this is required
"segment_text": ""
},
我的进步:
public static function getCampaignID($list_id){
$MCcampaigninfo = self::$mc_api->get("/campaigns"); // gives a response consisting 3 rows, required value is in 1st row, which is an array
foreach ($MCcampaigninfo as $key => $value) {
if ($value[8]->'list_id' == $list_id) { //under the 'campaign'array, we need the 9th position property 'recipient'
$campaign_id = $value[12]->'id';
}
}
}
【问题讨论】:
-
so
$mc_api->get("/campaigns");回馈 json? -
你想要所有广告系列的所有 id 吗?
-
有没有其他方法可以找到我的 'list_id' 的匹配项?
标签: php integration mailchimp-api-v3.0