Google Ads API JSON REST POST Request - MutateMembers

403 views
Skip to first unread message

Gregory Gan

unread,
Apr 16, 2020, 8:25:34 PM4/16/20
to AdWords API and Google Ads API Forum
Hi guys, 

So I've successfully created a userList through formulating the following JSON for a POST request: 


{
    "operations": [
        {
            "create": {
                "readOnly": false,
                "name": "vector-test-audience",
                "description": "A test audience post request",
                "membership_status": "OPEN",
                "membershipLifeSpan": 8,
                "sizeRangeForDisplay": "LESS_THAN_FIVE_HUNDRED",
                "sizeForSearch": "0",
                "sizeRangeForSearch": "LESS_THAN_FIVE_HUNDRED",
                "type": "CRM_BASED",
                "accessReason": "OWNED",
                "accountUserListStatus": "ENABLED",
                "eligibleForSearch": true,
                "eligibleForDisplay": true,
                "crmBasedUserList": {
                    "uploadKeyType": "CONTACT_INFO",
                    "dataSourceType": "FIRST_PARTY"
                }
            }
        }
    ]

And what I want to do now is to post a list of members (customers to match) with the fields Email, First Name, Last Name and Phone Numbers. I'm not sure if I can add another field onto the JSON above to populate with a list of members when creating a new audience list, or if I have to make a new JSON with a different namespace format. I've pretty much looked into the Google Ads documentation, youtube videos and code examples, but I haven't been able to find a clear cut solution to what I want to do. I know that there's a mutateOperation, but I'm not sure how I can use that to achieve what I want to do. 

Cheers,
Greg 

Google Ads API Forum Advisor Prod

unread,
Apr 17, 2020, 12:16:02 PM4/17/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Gregory,

Thank you for reaching out. Unfortunately, there is no way to add members to a UserList using Google Ads API at this moment. You will have to use mutateMembers from AdWords API or use the UI for now. Our team is aware of this feature request and the importance of it. You can keep an eye on our Developer Blog for information on future releases.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5001UZYbxK:ref
Message has been deleted

Gregory Gan

unread,
Apr 19, 2020, 6:08:31 PM4/19/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

Thank you for the reply back. I've been looking at the Google Adwords mutateMember as well, and there isn't an example or a clear explanation within the document  for how to structure the SOAP:XML request. I've manage to create the SOAP:XML POST request for creating a new Audience List (userList) as follows: 

<?xml version="1.0"?>
    <soapenv:Header>
      <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/rm/v201809" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
        <ns1:clientCustomerId>741-xxx-xxxx</ns1:clientCustomerId>
        <ns1:developerToken>RfVyeCacwnHAxxxxxxxx</ns1:developerToken>
        <ns1:userAgent>example.com:vectorAudiencePost:V1.0</ns1:userAgent>
        <ns1:validateOnly>false</ns1:validateOnly>
        <ns1:partialFailure>false</ns1:partialFailure>
      </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <ns7:operator xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201809">ADD</ns7:operator>
                <operand xmlns:ns8="https://adwords.google.com/api/adwords/rm/v201809" xsi:type="ns8:CrmBasedUserList">
                    <ns8:id>1</ns8:id>
                    <ns8:name>vector-test-audience-adwords-POST</ns8:name>
                    <ns8:description>A list of dummy customers</ns8:description>
                    <ns8:status>OPEN</ns8:status>
                    <ns8:membershipLifeSpan>365</ns8:membershipLifeSpan>
                    <ns8:uploadKeyType>CONTACT_INFO</ns8:uploadKeyType>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

But I'm not sure as to whether I have to now create the mutateMembers SOAP:XML and whether to create an entirely new one or I can somehow append the operation into the SOAP:XML I've made above. 

Cheers,
Greg  

ref:_00D1U1174p._5001UZYbxK:ref

Gregory Gan

unread,
Apr 20, 2020, 2:29:40 AM4/20/20
to AdWords API and Google Ads API Forum
Hi Mitchell, 

I was able to figure out the SOAP:XML for mutating the members. But I was wondering if you could attach a userId (and perhaps a hashed first and last name of a member) alongside the hashed email, phone number per member. As currently from I'm trying to also add <userId> </userId>  alongside the hashed email and phone number, but running to an internal error 500. From the document it should be possible, but I've got a feeling it might be something to do with the userList type I've set mine as? 

Cheers,
Greg 

Google Ads API Forum Advisor Prod

unread,
Apr 20, 2020, 12:38:46 PM4/20/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Gregory,

Unfortunately, it is not possible to upload multiple types for a crm_based_user_list as explained here. For example, if you use userId then you can't use contact_info (phone number, email, etc.) and vice versa.


Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5001UZYbxK:ref

Gregory Gan

unread,
Apr 26, 2020, 8:11:22 PM4/26/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

In the case, if the audience list I've uploaded are a 'crm_based_user_list', is there a way to delete only on specific members within the crm based user list? Or can I only do a delete on the whole member list and then upload a new one, that excludes the member I want to remove specifically? Also, can an audience list share a member list? Such that I can use the same member list I've uploaded to one audience list for another audience list. 

Cheers,
Greg  

Google Ads API Forum Advisor Prod

unread,
Apr 27, 2020, 11:09:11 AM4/27/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Greg,

You can only do this through AdWords API using mutateMembers REMOVE operation. You specify the members you want to delete in the MutateMembersOperand membersList. You can also delete the entire list by setting removeAll to true.

You can upload the same list of members to multiple UserLists but there's no way to explicitly share them.

Gregory Gan

unread,
Apr 27, 2020, 6:51:16 PM4/27/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

yeah in terms of using Google Adwords mutateMembers REMOVE operation to remove a specific member, would I instead of feeding the request a userID, I just feed in the sha256 email, phone etc for the member I want to remove? 

In terms of uploading the same list of members to multiple userLists, that makes sense and should be all good for what I'm doing. 

Cheers,
Greg 

Gregory Gan

unread,
Apr 27, 2020, 8:29:49 PM4/27/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

Also, with uploading a member list to an exisiting audience list with the Google Adwords API, it seems like it went through as the last upload date changed to the time and day I did the post my members list. However, the number of members size doesn't seem to change (as shown in the attached image). Not sure if that's okay or not, as I would want to (if could) see if all my members in the list of members uploaded when through. 

Cheers,
Greg 

 
Screen Shot 2020-04-28 at 10.24.41 am.png

Gregory Gan

unread,
Apr 28, 2020, 3:14:07 AM4/28/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

Just a follow up on the previous email, I'm trying to upload 1000+ members to my audience list with the SOAP:XML format: 

<?xml version="1.0"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/rm/v201809" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>xxx-xxx-xxxx</ns1:clientCustomerId>
            <ns1:developerToken>Rxxxxxxxxxxxx</ns1:developerToken>
            <ns1:userAgent>example.com:Test:xxx</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <mutateMembers xmlns="https://adwords.google.com/api/adwords/rm/v201809">
            <operations>
                <ns7:operator xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201809">ADD</ns7:operator>
                <operand>
                    <userListId>xxxxxxxxxx</userListId>
                    <membersList>
                        <hashedEmail>d480ad3fc4b40ae4361e4b26e223a0a5c0f04e3baf92a600ff42690d5576d136</hashedEmail>
                        <hashedPhoneNumber>4dc2b26583b308da70acbee670b5a5946dc37ca38ee71f9be023a0b093fa5b2b</hashedPhoneNumber>
                        <addressInfo>
                            <hashedFirstName>0d2c690e7dd5f94780383e9dfa1f4def044319104ad16ab15e45eeb2a8dfc81b</hashedFirstName>
                            <hashedLastName>b55d31756452520fc568e5981fdbb68185c8f9d38c9f91c15fe10afd2499f5c6</hashedLastName>
                            <countryCode>au</countryCode>
                            <zipCode> 4006 </zipCode>
                        </addressInfo>
                        <hashedEmail>779a43be8a05b79f0212b5aa6694f6e9f81de948b82cd5f9e2e2cbd14aa2f016</hashedEmail>
                        <hashedPhoneNumber>180d55631635a69f13578de3306e4a68b81804364c5a301cadb227831b7a054e</hashedPhoneNumber>
                        <addressInfo>
                            <hashedFirstName>01621148306fc8fb7c2b95eeb5c37e375f90db53cf8313ea87c9c34c05b7e0e5</hashedFirstName>
                            <hashedLastName>2a99130aeeee5aa3403ae8b3723f4d66b190d3c4e7c4a202f6498e72a25d36f4</hashedLastName>
                            <countryCode>au</countryCode>
                            <zipCode> 4006 </zipCode>
                        </addressInfo>
                    </membersList>
                </operand>
            </operations>
        </mutateMembers>
    </soapenv:Body>
</soapenv:Envelope>

Also, my audience list has the membership status as "OPEN" and when I put the request in postman, its getting a 200 status back with the last upload date changing. However, the size uploaded doesn't seem to change at all. Still saying there's 0 members in my audience list. Not sure if its because I'm on a test account or something else. 

Cheers,
Greg 

Google Ads API Forum Advisor Prod

unread,
Apr 28, 2020, 12:56:09 PM4/28/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Gregory,

To answer your first question, you need to feed it the list of members you want to remove. The members should be the same as they are in the UserList.

For your other questions, it can take up to 12 hours to show the updated UserList as explained here. If you added more than 1000 members to the list, the size should show properly. If it has been more than 12 hours and you are still seeing 0 members, please share your client customer ID via Reply privately to author.

Gregory Gan

unread,
Apr 28, 2020, 8:09:53 PM4/28/20
to AdWords API and Google Ads API Forum
Hi Michell,

Would being on a test account be the reason also as to why the size doesn't change? 

Cheers,
Greg 

Google Ads API Forum Advisor Prod

unread,
Apr 29, 2020, 10:02:47 AM4/29/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Gregory,

Yes, that is correct. As explained here, user lists are not supported in test accounts and will close upon creation.

Gregory Gan

unread,
May 7, 2020, 11:29:45 PM5/7/20
to AdWords API and Google Ads API Forum
Hi Mitchell,

I just wanted a clarification on the error 'CollectionSizeError.TOO_FEW' I'm getting when I'm running the REMOVE operator, for removing a member/s from my member list. I'm assuming its just the fact that my audience list doesn't have enough members in them to do the remove operation?

Cheers,
Greg   

Google Ads API Forum Advisor Prod

unread,
May 8, 2020, 10:57:34 AM5/8/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Greg,

As explained here, the membersList of members to remove needs to contain at least 1 member in order for the operation to run successfully. The size of the user list shouldn't cause this error. If you are specifying at least 1 member in the membersList and are still getting the error, please share your detailed request and response logs via Reply privately to author so I can further investigate the issue.

Gregory Gan

unread,
Jun 10, 2020, 7:41:04 PM6/10/20
to AdWords API and Google Ads API Forum
Hi Mitchell, 

I was wondering if the ability to retrieve all of the  Size:Search, Size:Youtube, Size:Display and Size:Gmail information through the Google Adwords/Ads api is supported. As the document is indicating that we can only retrieve the Size:Display (i.e. SszeForDisplay) and the Size:Search (i.e. sizeForSearch). We're also getting inconsistencies, with the sizeForSearch figure against the Size:Search figure in the UI, and that the Size:Display for one of our audience list is significantly low (i.e. 0 ) and I'm not to sure as to why that is for certain. 

Cheers,
Greg 

Google Ads API Forum Advisor Prod

unread,
Jun 11, 2020, 10:38:21 AM6/11/20
to gre...@customology.com.au, adwor...@googlegroups.com
Hi Greg,

You are correct that only size:Display and size:Search are available in the API. I have created a feature request for the others on your behalf so please keep an eye on our Developer Blog for information on future releases.

In terms of the discrepancy you're seeing, please share your client customer ID, downloaded report, and screenshot of the UI via Reply privately to author so I can further investigate the issue.


Regards,
Mitchell
Google Ads API Team

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