What is the version 11 equivalent of userListServiceClient.getUserList(resourceName) from version 9 of Google ads api?

40 views
Skip to first unread message

Ajit Trivedi

unread,
Jan 24, 2023, 11:09:56 AM1/24/23
to Google Ads API and AdWords API Forum
Hi
0

I am using version 9 of com.google.ads.googleads . I was using the following code snippet to get the UserList.

try (UserListServiceClient userListServiceClient = googleAdsClient.getLatestVersion().createUserListServiceClient()){ UserList userList = userListServiceClient.getUserList(resourceName); return userList; } catch (Exception e) { e.printStackTrace(); }

As version 9 is deprecated, I am trying to migrate to version 12 but I am not able to find the equivalent method in version 12.
Thanks

Google Ads API Forum Advisor

unread,
Jan 24, 2023, 3:25:11 PM1/24/23
to ajit.triv...@gmail.com, adwor...@googlegroups.com

Hi Ajit,
 

Thanks for reaching out to the Google Ads API team. I hope you are doing well today.
 

With regards to your concern, you may refer to this guide and this sample code on how to Add Logical User List in version 12.


Regards,

Google Logo
Darwin
Google Ads API Team
 



ref:_00D1U1174p._5004Q2iNAzV:ref

Ajit Trivedi

unread,
Jan 25, 2023, 4:14:17 AM1/25/23
to Google Ads API and AdWords API Forum
Hi Thanks, for the response. However, that does not answer my question.
What I am looking for is
1. I have a resourceName(String) and I want to get the UserList associated with that resourceName.
In google ads API, version 9 I was doing something like this

UserListServiceClient userListServiceClient =
googleAdsClient.getLatestVersion().createUserListServiceClient()
UserList userList = userListServiceClient.getUserList(resourceName);
However, google adsd api version 9 calls are blocked so I am looking for something that is equivalent to above piece of code in java in version 11 or 12 of google ads api.

Google Ads API Forum Advisor

unread,
Jan 25, 2023, 9:27:25 AM1/25/23
to ajit.triv...@gmail.com, adwor...@googlegroups.com
Hi Ajit,

Thank you for your reply. We appreciate your patience with this concern. 

To answer your questions, you may refer to this client library code example. To get the UserList associated, you may use this user_list report. For a comprehensive overview of changes based from v11 to v12, you may refer to this page.

You may use the below query:

SELECT user_list.id, user_list.name, user_list.resource_name, user_list.read_only, user_list.type FROM user_list WHERE user_list.resource_name IN ('customers/{customer_id}/userLists/{user_list_id}')

Let me know if you have any further questions.

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2iNAzV:ref

Ajit Trivedi

unread,
Jan 25, 2023, 3:26:29 PM1/25/23
to Google Ads API and AdWords API Forum
I am using this Query SELECT user_list.id, user_list.name FROM user_list WHERE user_list.resource_name ='customers/2787474591/userLists/7563699192'. using java code to get the user List but I am not getting anything as the output of that query. Can you please let me know why I am not getting any result for that query?

Ajit Trivedi

unread,
Jan 25, 2023, 3:59:38 PM1/25/23
to Google Ads API and AdWords API Forum
I can see in my account that there is a user list with Id 7563699192 but I am not able to get the details of that UserList using above query.

Google Ads API Forum Advisor

unread,
Jan 25, 2023, 11:52:12 PM1/25/23
to ajit.triv...@gmail.com, adwor...@googlegroups.com
Hi Ajit,

I work with Jinky. Thanks for getting back to us.

I've tried to pull the user list 7563699192 on my end against account 2787474591, and I was successfully able to pull it on my end. Can you try following the steps in this guide and perform a cURL request with your query?

curl -f --request POST "https://googleads.googleapis.com/v12/customers/2787474591/googleAds:search" \
--header "Content-Type: application/json" \
--header "developer-token: ${DEVELOPER_TOKEN}" \
--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--data '{
"pageSize": 10,
"query": "

  SELECT user_list.id, user_list.name FROM user_list WHERE user_list.resource_name ='customers/2787474591/userLists/7563699192'
"
}'

If the returned rows is still empty, and in order to further check why your query did not return any results, kindly provide us with the complete request and response logs with request header generated on your end when your query returns empty results. You may then send the requested logs via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

For the client library, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link .

Regards,
Google Logo
Abigail
Google Ads API Team
 


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