1

I am using Mailchimp's Marketing PHP API (https://github.com/mailchimp/mailchimp-marketing-php) to retrieve the templates list. It has the following code.

<?php
require_once '/path/to/MailchimpMarketing/vendor/autoload.php';

$client = new MailchimpMarketing\ApiClient();
$client->setConfig([
    'apiKey' => 'YOUR_API_KEY',
    'server' => 'YOUR_SERVER_PREFIX',
]);

$response = $client->templates->list();
print_r($response);

And it returns the whole set of other default templates (128 templates!), the api request parameter has type field which can be used to filter these templates. But I could not find anyway to pass the request parameter. Any idea?

Dipendra Gurung
  • 5,720
  • 11
  • 39
  • 62

1 Answers1

0

I am not sure if this is a correct approach but after going through API library source code, I found the correct function to include request parameters.

<?php
require_once '/path/to/MailchimpMarketing/vendor/autoload.php';

$client = new MailchimpMarketing\ApiClient();
$client->setConfig([
    'apiKey' => 'YOUR_API_KEY',
    'server' => 'YOUR_SERVER_PREFIX',
]);

$response = $this->client->templates->listWithHttpInfo($fields = null, $exclude_fields = null, $count = '10', $offset = '0', $created_by = null, $since_created_at = null, $before_created_at = null, $type = 'user', $category = null, $folder_id = null, $sort_field = null);

print_r($response);
Dipendra Gurung
  • 5,720
  • 11
  • 39
  • 62