oauth-4-laravel icon indicating copy to clipboard operation
oauth-4-laravel copied to clipboard

Mailchimp members request

Open alejoabella opened this issue 10 years ago • 1 comments

Good morning everyone. I'm using this library to integrate Mailchimp users with my application. Everything works fine to get the token and Mailchimp lists. But now I need to show these lists and their members respectively.

My code: $ Mc = OAuth :: consumer ('Mailchimp', 'my_uri_redirect'); $ Result = $ mc-> request ('lists / list');

This shows me the total list and their id. But i don't not know how to make the request for each list and bring its members.

Looking at the documentation of Mailchimp I found the following: http://apidocs.mailchimp.com/api/2.0/lists/members.php

This request asks for 2 parameters: a valid API Key for your user account and the list id to connect to.

I know the id of my lists but not how to build the request.

I already try the following: $ Result = $ mc-> request ('lists / members', array ('id' => 'my_list_id_q1w2e3r4t5'));

But it throws an exception: ErrorException strtoupper () expects parameter 1 to be string, array Given.

When i try $ Result = $ mc-> request ('lists / members'); It throws an exception too: OAuth \ Common \ Http \ Exception \ TokenResponseException Failed to request resource.

Anyone know how to properly build the request to pull the members of a single list?

Thank you very much!

alejoabella avatar Jun 10 '14 15:06 alejoabella

I found the solution:

$result2 = $mc->request('lists/members?id=my_list_id');

Thanks anyway!

alejoabella avatar Jun 11 '14 15:06 alejoabella