artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
684 stars 216 forks source link

Mailchimp members request #74

Open alejoabella opened 10 years ago

alejoabella commented 10 years ago

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 commented 10 years ago

I found the solution:

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

Thanks anyway!