RE: Retrieving all AdFields using Selector throws exceptio?

2019-07-26 Thread Google Ads API Forum Advisor Prod
Hi Suresh,

Thank you for posting your concern.

If you wish to retrieve the specific fields using the AdService, you may refer 
to this link.

Talking about the selector that you've used, I can see that you are using the 
AdService.get operation to retrieve the data of your ads. But for your 
convenience, we have readily available Java sample code that you can use to 
retrieve the data of your ads. In this example, the AdGroupAdService.get() is 
used. You may try and implement something similar to that example using your 
preferred service, which is the AdService.

If the error persists, let me know and you can provide the complete SOAP 
requests and response logs via Reply privately to author option together with 
customer ID.

Regards,
Ejay
Google Ads API Team
ref:_00D1U1174p._5001UEGQlL:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/pwohy0PV8N7O00O_ygDBdESCGlyt4LKcmVlA%40sfdc.net.


Retrieving all AdFields using Selector throws exceptio?

2019-07-25 Thread Suresh Kumar Shenbagam
Hi,

I was trying to retrieve all Ad fields for Ads inside an AdGroup. If my 
AdGroup has multiple ads, say for example 5 ads each one is of different 
type like Expanded Text Ad, MultiAssetAd etc.,

Now, I collect all the AdIds inside an AdGroup and pass it to the selector, 
I am getting INVALID_FIELD_NAME exception.

Sample code:

public static List loadAds(
  AdWordsServicesInterface adWordsServices, AdWordsSession session, 
Collection adIds) {


AdServiceInterface adService = adWordsServices.get(session, 
AdServiceInterface.class);


List ads = new ArrayList<>();


int offset = 0;


// Create selector.
SelectorBuilder builder =
new SelectorBuilder()
.fields(AdField.values())
.in(AdField.Id, adIds.toArray(new String[0]))
.offset(offset)
.limit(PAGE_SIZE_LIMIT);


AdPage page = new AdPage();
do {
  // Get campaigns.
 // page = withRetryPolicy(() -> adService.get(builder.build()));


  try {page = adService.get(builder.build());} catch (RemoteException e
){// TODO Auto-generated catch block
  e.printStackTrace();}
  if (page.getEntries() != null) {
ads.addAll(Arrays.asList(page.getEntries()));
  }


  offset += PAGE_SIZE_LIMIT;
  builder.increaseOffsetBy(PAGE_SIZE_LIMIT);
} while (offset < page.getTotalNumEntries());


return ads;
  }

How can I retrieve all the AdFields?

Suresh

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7589d7f4-a6b4-4758-926d-2e1c7fb27aee%40googlegroups.com.