Removing members from a Crm user list with user list service's mutateMembers?

119 views
Skip to first unread message

yo...@adgorithms.com

unread,
Jul 17, 2016, 2:45:31 AM7/17/16
to AdWords API Forum
Hello,

I'm trying to understand how to add a user list and fill it with members. I've already managed to add members to a list by following the example code.
But, I can't find out how to remove members from the said list. I've tried sending the exact same request using the REMOVE/ SET operators but I received an unknown error (Added below).
The API documents claim that the remove/set operator is supported. Any Idea whats is wrong? 

    response = user_list_service.mutateMembers([mutate_members_operation])
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 323, in MakeSoapRequest
    for arg in args])
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 235, in _PackForSuds
    return [_PackForSuds(item, factory) for item in obj]
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 232, in _PackForSuds
    new_obj[key] = _PackForSuds(obj[key], factory)
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 232, in _PackForSuds
    new_obj[key] = _PackForSuds(obj[key], factory)
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 237, in _PackForSuds
    _RecurseOverObject(obj, factory)
  File "build/bdist.linux-x86_64/egg/googleads/common.py", line 255, in _RecurseOverObject
    copy_of_obj = tuple(obj)
TypeError: 'type' object is not iterable


Joyce Lava

unread,
Jul 17, 2016, 10:53:34 PM7/17/16
to AdWords API Forum
Hi,

To better analyze the issue you encountered, I would need the SOAP request and response. Could you please send them to me by clicking reply privately to author?

However, regarding the removal of members from the CrmBasedUserList, you will need to use MutateMembersOperation with REMOVE operator and pass the list of members to be removed. These members should be formatted according to the specified dataType.

Best Regards,
Joyce, AdWords API Team

yo...@adgorithms.com

unread,
Jul 18, 2016, 1:57:05 AM7/18/16
to AdWords API Forum
Thank you for your reply,

Unfortunately, I cannot send the SOAP request and the request fails prior to actually sending it to the server. 
As can be seen from the error log I attached, this is some sort of error in the package while trying to build the request and not with the reply from the server.

I updated the package to the latest version but I'm still getting the same result.

I'm attaching the code i'm using, which is basically a copy of the API example in python. This code works when using the ADD operator instead of REMOVE.
    mutate_members_operation = {
        'operand': {
            'userListId': list_id,
            'dataType': 'EMAIL_SHA256',
            'members': hashed_emails
        },
        'operator': 'REMOVE'
    }
    try:
        set_adwords_client(account_id)
        user_list_service = get_service(Services.ADWORDS_USER_LIST_SERVICE)
        response = user_list_service.mutateMembers([mutate_members_operation])

Thanks!

Joyce Lava

unread,
Jul 18, 2016, 5:05:45 AM7/18/16
to AdWords API Forum
Hi,

I understand that the issue in your case could not generate the SOAP request and that it worked for ADD operator. However, just to help more on the analysis, could you also confirm if you are using this example code? I just noticed that in the example code, the AdWords API version is indicated. Could you please try once more the same way as it is in the example code I provided (using REMOVE operator of MutateMembersOperation) and let me know the results?

Thanks and Regards,
Joyce, AdWords API Team
Reply all
Reply to author
Forward
0 new messages