Get all user lists and list them

1,445 views
Skip to first unread message

Nikolay Todorov

unread,
Jul 2, 2018, 3:43:36 PM7/2/18
to AdWords API and Google Ads API Forum
Hi there,

I am working on custom Adwords integration into company project. I need to pull all the  user lists under a given account. I already have working requests to the api. For example I can execute without problems the following example script AddCrmBasedUserList and create a new user list with some emails inside.

Could you please let me know which classes I have to use or provide some code example how to get the user list instead of creating new one? I need to add/delete emails from the existing user lists.

Any help will be appreciated as it seems that there are no resources about this online.

Kind regards,
Nikolay

Peter Oliquino (AdWords API Team)

unread,
Jul 3, 2018, 2:25:38 AM7/3/18
to AdWords API and Google Ads API Forum
Hi Nikolay,

Currently the AdWordsUserListService.get() only supports retrieving information at the UserList level and not its members. As for updating the list of the members itself, this is also not support since the AdWordsUserListService.mutateMembers() does not support the SET operator.

If you wish to update the members, you would first need to REMOVE the list using the AdWordsUserListService.mutateMembers() then ADD them again, but this time, with the updated list of members. Let me know if this helps.

Thanks and regards,
Peter
AdWords API Team

Peter Oliquino (AdWords API Team)

unread,
Jul 4, 2018, 6:08:24 AM7/4/18
to AdWords API and Google Ads API Forum
Hi Niko,

Thank you for the sample code you provided for other users. For the benefit of others with the same concern, below is some of the details of our conversation :

Niko : "Just to confirm:

1.    There is no way to retrieve ids and names of all user lists that we already created manually?

2.    Can we delete the members and insert the new ones or we should always delete the list and create a new one?"

 

Peter : "1. For getting your UserLists, you can do so by using the AdwordsUserListService.get(). The list that you would not be able to retrieve via the AdWords API would be the list of Members.


2. Updating the list of members by just adding or removing items from an existing list is not supported. You would need to REMOVE the entire list of members and then re-ADD them using the AdwordsUserListService.mutateMembers() method."

Niko : "Thanks a lot, i will pass this to the people managing the implementation of this.

Actually i wrote some code for retrieving user lists in AddCrmBasedUserList.php example:

Pasting the code bellow inside the runExample() method will print the user lists:

        $userListService = $adWordsServices->get($session, AdwordsUserListService::class);
        $selector             = new Selector();
        $selector->setFields(['Id']);
        $selector->setPaging(new Paging(0, 500));
        $res = $userListService->get($selector);
        $res = $res->getEntries();
        foreach ($res as $key => $value) {
            echo $value->getId() . ': ' . $value->getName() . PHP_EOL;
        }

I am sending it if someone else ask the same.

Have a nice day."

Best regards,
Peter
AdWords API Team

Peter Oliquino (AdWords API Team)

unread,
Jul 11, 2018, 11:18:09 PM7/11/18
to AdWords API and Google Ads API Forum
Hi Niko and to everyone following this thread,

My apologies for the confusion in my previous post. To correct the process I mentioned, the REMOVE operation should no longer be required when adding new members to an existing list. Users should be able to send an ADD operation directly using the AdwordsUserListService.mutateMembers() to add new members within their lists.

Vignesh

unread,
Jan 9, 2022, 9:32:04 AM1/9/22
to AdWords API and Google Ads API Forum
Hi,
In Google Ads API, what is the equivalent of AdWordsUserListService.get(). I am looking to fetch the user lists which matches the selection criteria exactly as mentioned in this link - https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService#get

For example in AdWords API, I have built a Selector like below to query UserList. How do I do the same in Google Ads API in 2022 ?
 SelectorBuilder builder = new SelectorBuilder();
 Selector selector = builder.fields("Id", "Name", "Size", "SizeForSearch", "Status").equals("ListType", UserListTypeEnum.UserListType.CRM_BASED.toString()).offset(offset).limit(PAGE_SIZE).build();

Thanks,
Vignesh

Google Ads API Forum Advisor

unread,
Jan 9, 2022, 10:59:50 PM1/9/22
to thegreat...@gmail.com, adwor...@googlegroups.com

Hi Vignesh,

Thanks for your reply.

For the AdWordsUserListService from the AdWords API, you may use the UserListService service using GetUserList in the Google Ads API. You may also use the reporting feature along with the pagination to fetch the user lists using the user_list report.

Let us know if you have any further questions.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Ui99f:ref
Reply all
Reply to author
Forward
0 new messages