Hi Yasar,

Thanks for that very prompt reply!
I did actually manage to sort this out, thusly:

    protected static Campaign getCampaign(String resourceName) {
        final GoogleAdsServiceClient googleAdsServiceClient = 
googleAdsClient.createGoogleAdsServiceClient();
        try {
            final String query = "SELECT campaign.id, 
campaign.resource_name FROM campaign WHERE campaign.resource_name='"
                    + resourceName + "'";
            final SearchGoogleAdsRequest request = SearchGoogleAdsRequest.
newBuilder(). //
                    setCustomerId(customerId). //
                    setPageSize(8). //
                    setQuery(query). //
                    build();
            final SearchPagedResponse searchPagedResponse = 
googleAdsServiceClient.search(request);
            Campaign campaign = null;
            for (final GoogleAdsRow googleAdsRow : searchPagedResponse.
iterateAll()) {
                if (campaign != null) {
                    throw new RuntimeException("more than one result 
returned for query : " + query);
                }
                campaign = googleAdsRow.getCampaign();
            }
            return campaign;
        } finally {
            close(googleAdsServiceClient);
        }
    }


and similar for getAdGroup.

This is, of course, so much simpler than the old way of doing things.....

Anyway, thanks again for the advice!


On Thursday, 30 June 2022 at 15:28:18 UTC+2 adsapi wrote:

> Hi Marc,
>
> Thanks for reaching out to the Google Ads API Forum.
>
> Upon checking your method, it appears that you’re trying to use GET 
> methods. However In the Google Ads API V10 version, GET methods have been 
> removed from all services. Any service that exclusively had a get method 
> has been removed as well. The primary way to *retrieve objects* 
> <https://developers.google.com/google-ads/api/docs/concepts/retrieving-objects>
>  
> continues to be using GoogleAdsService's search and searchStream methods. 
> For a comprehensive overview of changes based from v9 to v10, you may refer 
> to this *page* 
> <https://developers.google.com/google-ads/api/docs/version-migration#v9-v10>, 
> and inspecting objects with get (Deprecated) is deprecated since the usage 
> of "get" in this API was only intended for exploratory purposes and not 
> actually retrieving data as mentioned *here* 
> <https://developers.google.com/google-ads/api/docs/concepts/changing-objects#inspecting_objects_with_get_deprecated>
> . 
>
> Let us know if you have any further questions.
>
> Regards,
> [image: Google Logo] 
> Yasar 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2cErFS: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 
"Google Ads API and AdWords 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/b6bd2559-68db-44a4-9fb8-cc25a43a1980n%40googlegroups.com.
  • Wh... Marc Donis
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Marc Donis
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to