mailchimp-api
mailchimp-api copied to clipboard
Can this library be used for export API?
can this library be used with MailChimp's export api? https://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-the-export-api/
is it the same as the api implementation?
I have the same question.
I think, you are simply using the MailChimp instance like this
$mailChimp = new MailChimp($apiKey, https://<dc>.api.mailchimp.com/export/1.0/);
$result = $mailChimp->post('list');
Maybe it will be necessary to adapt the return according to the format that is returned. Can you try and make a feedback please ?
Did you folks conclude if this was possible? I've not used at the export API, so haven't tried it myself.
It works, if you override some stuff but the response is empty because MC sends a series of JSON objects separated by \n which formatResponse() rightfully does not expect.
$this->api = new MailChimp(MAILCHIMP_API_KEY, 'https://'.MAILCHIMP_DC.'.api.mailchimp.com/export/1.0');
$ret = $this->api->get('list/', [
'apikey' => MAILCHIMP_API_KEY, /* REQUIRED PARAMETER */
'id' => $this->id_list,
'status' => $status,
'hashed' => 'sha256'
], 60);
Output snippet:
["EMAIL_HASH"]
["e30290504178be7dd98f2365195e866473c709c4c50fb6ad7829238459cad685"]
["5b67a4f61804e8fca866ede6753fcdb25312039798fc004e1383f9e698792925"]
I suppose it would be necessary to add a case to the construct for <dc> and especially enhance the formatter. Or have a raw response option and let the user deal with it.
EDIT: The API returns a stream so more changes would be necessary. I am just Guzzling it for now.