Hello Jason,

The mutate and mutateMembers are two different operations as listed in the
code sample. You will first need to create a user list which will include
the user list fields as listed here from L38 - L45
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py#L38-L45>.
Once the user list is added you will need to perform the mutateMembers
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py#L62-L71> operation
to add users to the list. It looks like you're combining them in a single
operation. you will need to create an Info object (e.g.,
CrmBasedUserListInfo) and set it to the UserList object via
the setCrmBasedUserList() method. You can then use the mutateUserLists
<https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v0.services#mutateuserlistsrequest> operation
to add the members to the list.

CrmBasedUserListInfo userList = CrmBasedUserListInfo.newBuilder()
.setUploadKeyType(CustomerMatchUploadKeyType.CONTACT_INFO)
.build();

UserList newUserList = UserList.newBuilder()
.setName(StringValue.of("Oler user list test 1"))
.setCrmBasedUserList(userList)
.build();

UserListOperation userListOperation = UserListOperation.newBuilder()
.setCreate(newUserList)
.build();

It is similar to the AddExpandedTextAds
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogleads%2Fgoogle-ads-java%2Fblob%2Fmaster%2Fgoogle-ads-examples%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fads%2Fgoogleads%2Fexamples%2Fbasicoperations%2FAddExpandedTextAds.java%23L109&sa=D&sntz=1&usg=AFQjCNHx77dGqN13a5BLa36pnp3net4GyA>
 example.

@Afonso: I see that your concern has been addressed on this thread
<https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/adwords-api/imOgsTnmDc0/YmAvQeS5BQAJ>.
Please continue the discussion on that thread to avoid duplicates.

Thanks,
Bharani, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 02/25/19 13:44:50 afonso.pr...@vtex.com.br wrote:

Hello
謝子皓
How did you manage to authenticate using just REST? I'm using Node.js too
and I am finding issues to do that.

Best,

On Monday, February 25, 2019 at 1:28:28 PM UTC-3, 謝子皓 wrote:

Since I use Node.js and there is no Google Ads API client library in
Node.js so I choose to use REST API.

Following this Call Structure document
<https://developers.google.com/google-ads/api/docs/concepts/call-structure>,
I can create userList via REST API via HTTP POST to *https://googleads.googleapis.com/v0/customers/31259999xx/userLists:mutate
<https://googleads.googleapis.com/v0/customers/31259999xx/userLists:mutate>
*with auth info on headers and below body data

{
  "operations": [
    {
      "create": {
        "readOnly": false,
        "name": "jason-test-audience-name-3",
        "description": "test",
        "membershipStatus": "OPEN",
        "membershipLifeSpan": "540",
        "sizeForDisplay": "0",
        "sizeRangeForDisplay": "LESS_THAN_FIVE_HUNDRED",
        "sizeForSearch": "0",
        "sizeRangeForSearch": "LESS_THAN_FIVE_HUNDRED",
        "type": "CRM_BASED",
        "accessReason": "OWNED",
        "accountUserListStatus": "ENABLED",
        "eligibleForSearch": false,
        "eligibleForDisplay": true,
        "crmBasedUserList": {
          "appId": "com.garena.game.kgvn",
          "uploadKeyType": "MOBILE_ADVERTISING_ID",
          "dataSourceType": "FIRST_PARTY"
        }
      }
    }
  ]
}

Enter code here...

I can received correct response as below
{
    "results": [
        {
            "resourceName": "customers/3125820670/userLists/769964xxx"
        }
    ]
}

But I cannot find any fields according to this
<https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v0.resources#google.ads.googleads.v0.resources.UserList> in
the request body to upload my *.csv files or array of ids so I ended up
create a audience list without csv file.


By tracing back to AdWords API python client library's example code :

googleads-python-lib/examples/adwords/v201809/remarketing/
add_crm_based_user_list.py
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py>

I realized it might need to call different API.

one for creating user list
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py#L54>

result = user_list_service.mutate(operations)

one for updating members in the user list
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py#L81>

response = user_list_service.mutateMembers([mutate_members_operation])


How can I do the equivalent of add_crm_based_user_list.py
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201809/remarketing/add_crm_based_user_list.py>
 example do in the Google Ads API v0 via REST API?

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/1f4d75b3-29aa-48d9-a79f-72a67d8ce672%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/1f4d75b3-29aa-48d9-a79f-72a67d8ce672%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/00d12jeahg000001gglves000rku48x6gmj4c1n74o30c1g68qjac1n%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • Re: Equ... Afonso Praça
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Jason Hsieh
    • Re... Jason Hsieh
      • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to