CrmBasedUserList - clear a list (full cleaning)

152 views
Skip to first unread message

alexande...@vseinstrumenti.ru

unread,
Aug 31, 2018, 2:02:30 AM8/31/18
to AdWords API and Google Ads API Forum
Hi,help me please...

I can not find an api method that will allow me to clear the list at a time.
Point removal (MutateMembersOperation -> operator -> REMOVE) is not of interest, because I may not know the contents of the list.


Thank you in advance.

Dannison Yao (AdWords API Team)

unread,
Aug 31, 2018, 4:20:48 AM8/31/18
to AdWords API and Google Ads API Forum
Hi,

If you wish to delete all members of a userList, you could use the MutateMembersOperand and set the removeAll field to TRUE while using the REMOVE operator. However, if you wish to remove individual members in the list, you could use the AdwordsUserListService.mutateMembers() to REMOVE a member using MutateMembersOperand.membersList in your userlist. 

Regards,
Dannison
AdWords API Team

alexande...@vseinstrumenti.ru

unread,
Aug 31, 2018, 8:29:26 AM8/31/18
to AdWords API and Google Ads API Forum
Many thanks for the prompt response!

I have already tried to solve this issue on my own:

$adWordsServices = new AdWordsServices();

$userListService = $adWordsServices->get(self::$session, AdwordsUserListService::class);

$mutateMembersOperations = [];
$mutateMembersOperation = new MutateMembersOperation();
$operand = new MutateMembersOperand($UserListId, true);

$mutateMembersOperation->setOperand($operand);

$mutateMembersOperations[] = $mutateMembersOperation;

$result = $userListService->mutateMembers($mutateMembersOperations);

var_dump($result);

errors like no, but I'm not sure that the list is cleared, because detailed information can not be obtained.

Help please with the code.


пятница, 31 августа 2018 г., 11:20:48 UTC+3 пользователь Dannison Yao (AdWords API Team) написал:

Dannison Yao (AdWords API Team)

unread,
Sep 2, 2018, 11:20:27 PM9/2/18
to AdWords API and Google Ads API Forum
Hi,

For AdWordsUserListService, AdWords API only allows you to view the list but not its actual members, so it is not possible to see in the response the detailed information of the members that are being deleted. However, if you wish to know if this is possible in the AdWords UI, you may open your concern in the Advertiser's Community Forum as the product experts are better answering UI/product related concerns.

If you wish to view the list of audience lists, you may view your lists by running the AdwordsUserListService.get().

Regards,
Dannison
AdWords API Team

alexande...@vseinstrumenti.ru

unread,
Sep 3, 2018, 1:53:22 AM9/3/18
to AdWords API and Google Ads API Forum
Thank you so much,
but what about the code? is it correct?

понедельник, 3 сентября 2018 г., 6:20:27 UTC+3 пользователь Dannison Yao (AdWords API Team) написал:

Dannison Yao (AdWords API Team)

unread,
Sep 3, 2018, 4:55:45 AM9/3/18
to AdWords API and Google Ads API Forum
Hi,

Your code seems to be correct. You may use this sample code to pattern your existing code. You could run your code and confirm if there are indeed no errors. Should errors persist, feel free to write back with the error details or SOAP request and response logs for me to investigate further via Reply privately to author.

Regards,
Dannison
AdWords API Team

cv

unread,
Jun 22, 2020, 7:12:28 AM6/22/20
to AdWords API and Google Ads API Forum
Hi,

Is this correct way to doing it?

I also wanted to confirm this will remove only userList Passed.

Thanks

$userListService = $adWordsServices->get($session, AdwordsUserListService::class);
        $mutateMembersOperations = [];
        
        $mutateMembersOperation = new MutateMembersOperation();
        $operand = new MutateMembersOperand();
        $operand->setUserListId($listId);
        $operand->setRemoveAll(true);
        
        $mutateMembersOperation->setOperand($operand);
        $mutateMembersOperations[] = $mutateMembersOperation;
        $result = $userListService->mutateMembers($mutateMembersOperations);


On Monday, 3 September 2018 14:25:45 UTC+5:30, Dannison Yao (AdWords API Team) wrote:
Hi,

Your code seems to be correct. You may use this sample code to pattern your existing code. You could run your code and confirm if there are indeed no errors. Should errors persist, feel free to write back with the error details or SOAP request and response logs for me to investigate further via Reply privately to author.

Regards,
Dannison
AdWords API Team

Google Ads API Forum Advisor Prod

unread,
Jun 22, 2020, 10:07:33 AM6/22/20
to chirag....@gmail.com, adwor...@googlegroups.com
Hi,

Yes, that code looks correct as long as the REMOVE operator is bring used. Yes, it will only remove the members of the user list specified.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q218KJc:ref

cv

unread,
Jun 23, 2020, 12:12:11 AM6/23/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

I need to remove all the members.

Yes, that code looks correct as long as the REMOVE operator is bring used.
-> Is this diffrent then this line?
$operand->setRemoveAll(true);

This remove all operator is set.

Thanks

Google Ads API Forum Advisor Prod

unread,
Jun 23, 2020, 9:52:05 AM6/23/20
to chirag....@gmail.com, adwor...@googlegroups.com
Hi, 

Yes, they are different things. The removeAll attribute needs to be set to true but also the mutateMembersOperation should be set to REMOVE.

cv

unread,
Jun 24, 2020, 2:04:25 AM6/24/20
to AdWords API and Google Ads API Forum
Thanks Mitchell,

Got the point.

I need to also set 

$mutateMembersOperation->setOperator(Operator::REMOVE);


Thanks,
Reply all
Reply to author
Forward
0 new messages