UserDataService w/ .NET Client Library

54 views
Skip to first unread message

Ian Wills

unread,
May 3, 2022, 11:30:43 PM5/3/22
to Google Ads API and AdWords API Forum
Hello all,

Working on migrating from Adwords API to Google Ads API. Trying to assess between using UserDataService and OfflineUserDataJobService. I haven't found an example for UserDataService, so I'm trying to mimic the example for OfflineUserDataJobService found here. When trying to add Operations to UploadUserDataRequest, I find it is readonly. Is this intended? Am I not using it correctly, or could it be not implemented?

Also trying to better understand what these services are doing:
  • It looks like our current code for Adwords Api (MutateMembersOperation) makes an effort to only add new contacts to an audience, not upload the whole thing every time. Is the intent seemingly of OfflineUserDataJobService to upload the whole audience every time?
  • Similar to this question, I'm not positive from the documentation how one is supposed to  append contacts to an audience. Does putting them into Create, and then sending them to an audience append? Or does it re-make the audience? The doc makes it sound like it appends but I'm not sure.

Thanks

Google Ads API Forum Advisor

unread,
May 5, 2022, 11:16:22 AM5/5/22
to ian.w...@gmail.com, adwor...@googlegroups.com
Hi Ian,

Thank you for posting your concern.

Please see my answer below for each concern that I've noticed:

"When trying to add Operations to UploadUserDataRequest, I find it is readonly. Is this intended? Am I not using it correctly, or could it be not implemented?"
-The UploadUserDataRequest should not be readonly. With this, I would suggest referring to this document as it illustrates how to upload customer members using UserDataService.


"It looks like our current code for Adwords Api (MutateMembersOperation) makes an effort to only add new contacts to an audience, not upload the whole thing every time. Is the intent seemingly of OfflineUserDataJobService to upload the whole audience every time?"
"Similar to this question, I'm not positive from the documentation how one is supposed to  append contacts to an audience. Does putting them into Create, and then sending them to an audience append? Or does it re-make the audience? The doc makes it sound like it appends but I'm not sure."
-To answer the 2 items above, the OfflineUserDataJobService will indeed append the members if it is a new unique user. However, if you want to update the member list, then you will have to remove (ways to remove members) the specific members and make 'create OfflineUserDataJobOperation'.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2aQGgO:ref

Ian Wills

unread,
May 5, 2022, 12:15:11 PM5/5/22
to Google Ads API and AdWords API Forum
Here is an example of how I am seeing Operations being readOnly. Some confidence I have that this is the intended use is this test here: UserDataServiceClientTest.g.cs

UserDataServiceClient service = client.GetService(Services.V10.UserDataService);
List<UserDataOperation> userDataOperations = new List<UserDataOperation>(hashedEmails.Count);
UploadUserDataRequest uploadUserDataRequest = new UploadUserDataRequest() { CustomerId = customer, CustomerMatchUserListMetadata = { UserList = returnIt.FirstOrDefault().ResourceName } };
uploadUserDataRequest.Operations = userDataOperations;
service.UploadUserData(uploadUserDataRequest);


Google.Protobuf.Collections.RepeatedField<UserDataOperation> UploadUserDataRequest.Operations { get; }
Required. The list of operations to be done.

CS0200: Property or indexer ' UploadUserDataRequest.Operations' cannot be assigned to -- it is read only

Google Ads API Forum Advisor

unread,
May 6, 2022, 1:54:15 PM5/6/22
to ian.w...@gmail.com, adwor...@googlegroups.com
Hi Ian,

The UploadUserDataRequest isn't read only. However, if you have a specific inquiry regarding the .NET client library, please reach out to the client library owners here.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


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