drewm / mailchimp-api

Super-simple, minimum abstraction MailChimp API v3 wrapper, in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can I GET merge-fields using this class?

EdLem opened this issue · comments

commented

I am try to get merge fields, but I am unable to guess the exact syntax, if this i capable of getting merge-fields. Code is like:

include ("./MailChimp.php");

$list_id = $_POST['list_id'];
$api_key = "mykey";

use \DrewM\MailChimp\MailChimp;
$MailChimp = new MailChimp($api_key);
$response = $MailChimp->get('lists/$list_id/merge-fields');
print_r($response);

I have also tried:
$response = $MailChimp->get('lists/merge-fields', $list_id);
and
$response = $MailChimp->get('merge-fields', $list_id);
and a whole bunch of other combinations, but everything produces:

Array
(
[type] => http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
[title] => Resource Not Found
[status] => 404
[detail] => Invalid path
[instance] => 8543a2f4-7f70-4ede-aada-00cf0621e443
)

I am able to get list information, so I have the basics working. I don't see any merge-fields when using:
$response = $MailChimp->get('lists', $list_id);

which does return the details on any specific list. I originally thought that this GET would show the merge-fields, but they are not included in the array.

Thanks

Which part of the API are you using here?