ActiveCampaign / activecampaign-api-nodejs

Node.js wrapper for the ActiveCampaign API
MIT License
39 stars 36 forks source link

Cannot retrieve contacts by listid #16

Closed landland closed 8 years ago

landland commented 8 years ago

Hello, I can't seem to retrieve contacts by listid. Here's my code

var contacts_get = ac.api("contact/list?listid=1", {});
        contacts_get.then(function(result) {
            // successful request
            console.log("result is ", result);
        }, function(result) {
            // request error
        });

However, if I change the request contact/list?ids=all I get all contacts. I've also tried contact/list?ids=all&listid=1 but that returns all contacts, even those not part of the listid. Is this a bug or am I missing something? Thanks.

pevans commented 8 years ago

You should be able to use the filter parameter to pass in a list id. Check out the example script for contact_list, which mentions all the possible filter params you can use.

landland commented 8 years ago

That's what I think I did. I used the filter listid=1 but it didn't work. Am I entering the filter incorrectly?

landland commented 8 years ago

I see. I had to use filters[listid]=1. I didn't see that in the node docs. Thank you.

pevans commented 8 years ago

You're welcome! Glad it's working for you now.