I'm attempting to recreate the basic functionality in the Campaign > Locations section, specifically with specifying a radius. After some digging it looks like I should be using the Proximity Criteria Type in the CampaignCriterionService, but when I retrieve the list from the criteria, the Address block is mostly empty. All that I receive is provinceName. My current campaign settings specify a radius of x-Miles for a specific zip code. I'd expect to see postalCode returned with the provinceName.
Here's a snippet for my C# implementation:
var campaignService = (CampaignCriterionService)request.AdWordsUser.GetService(AdWordsService.v201705.CampaignCriterionService);
var campaignLocationPage = campaignService.get(new Selector
{
fields = new string[]
{
Criterion.SelectableFields.Id,
Criterion.SelectableFields.CriteriaType,
Proximity.SelectableFields.Address,
Proximity.SelectableFields.GeoPoint,
Proximity.SelectableFields.RadiusDistanceUnits,
Proximity.SelectableFields.RadiusInUnits
},
predicates = new Predicate[]
{
new Predicate
{
field = Criterion.FilterableFields.CriteriaType,
@operator = PredicateOperator.EQUALS,
values = new string[] { CriterionType.PROXIMITY.ToString() }
},
new Predicate
{
field = "CampaignId",
@operator = PredicateOperator.IN,
values = request.CampaignIdList.Select(x => x.ToString()).ToArray() // This is just a list of campaign IDs converted into an array of strings
}
}
});
I've found other posts where this type of query settings are recommended, but they don't show full code snippets, or address the issue of an empty Address.
I've gone so far as to try to hard-code the names of the Address fields in my Selector's fields, (ex: "PostalCode" or "POSTALCODE") and received an error back from the API, stating that the field name is invalid.
Thank you in advance. Any help would be greatly appreciated!