Hi team
I'm trying to fetch all the campaigns with a given name using the below query:
SearchGoogleAdsRequest request =
SearchGoogleAdsRequest.
newBuilder()
.setCustomerId(Long.
toString(customerId))
.setPageSize(1_000)
.setQuery(
String.
format(
"SELECT
campaign_budget.id,
campaign_budget.name, "
+ "campaign_budget.resource_name FROM campaign_budget "
+ "WHERE
campaign.name = '%s'",
campaignName))
.build();
// Retrieves the budget.
GoogleAdsServiceClient googleAdsServiceClient =
googleAdsClient.getLatestVersion().createGoogleAdsServiceClient();
GoogleAdsServiceClient.SearchPagedResponse searchPagedResponse = googleAdsServiceClient.search(request);
System.
out.println(searchPagedResponse.getPage().getResponse().getResults(0).getCampaignBudget());
However, I'm getting the below error:
Headers: Metadata(content-type=application/grpc,request-id=******,date=Tue, 02 Nov 2021 12:13:04 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43")
Body: null
Failure message: errors {
error_code {
query_error: EXPECTED_REFERENCED_FIELD_IN_SELECT_CLAUSE
}
message: "The following field must be present in SELECT clause: \'
campaign.name\'."
}
request_id: "*******************"
Status: Status{code=INVALID_ARGUMENT, description=Request contains an invalid argument., cause=null}.
I'm using GoogleAds API.
Kindly tell if it is possible to get a campaign with a particular name. (NOT resource name - just the campaign name).
Thanks!