Hi,
For our business purposes we have to get the list of countries which campaign is targeting. For this we use CampaignCriterion service and fetch criterions of type location, it returns geo_target_constants and with them we get the list of countries set in campaign.
But we faced with one issue - it looks like it's impossible to differentiate excluded and targeted countries which are set in campaign settings.
How it looks on UI:
As you can see these are completely different things from the point of view of business.
BUT API returns these locations together. Example of response for the same account/campaign:
[{'resource_name': 'geoTargetConstants/2032', 'id': '2032', 'name': 'Argentina', 'country_code': 'AR', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Argentina'}, {'resource_name': 'geoTargetConstants/2036', 'id': '2036', 'name': 'Australia', 'country_code': 'AU', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Australia'}, {'resource_name': 'geoTargetConstants/2068', 'id': '2068', 'name': 'Bolivia', 'country_code': 'BO', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Bolivia'}, {'resource_name': 'geoTargetConstants/2076', 'id': '2076', 'name': 'Brazil', 'country_code': 'BR', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Brazil'}, {'resource_name': 'geoTargetConstants/2124', 'id': '2124', 'name': 'Canada', 'country_code': 'CA', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Canada'}, {'resource_name': 'geoTargetConstants/2152', 'id': '2152', 'name': 'Chile', 'country_code': 'CL', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Chile'}, {'resource_name': 'geoTargetConstants/2170', 'id': '2170', 'name': 'Colombia', 'country_code': 'CO', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Colombia'}, {'resource_name': 'geoTargetConstants/2188', 'id': '2188', 'name': 'Costa Rica', 'country_code': 'CR', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Costa Rica'}, {'resource_name': 'geoTargetConstants/2208', 'id': '2208', 'name': 'Denmark', 'country_code': 'DK', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Denmark'}, {'resource_name': 'geoTargetConstants/2214', 'id': '2214', 'name': 'Dominican Republic', 'country_code': 'DO', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Dominican Republic'}, {'resource_name': 'geoTargetConstants/2218', 'id': '2218', 'name': 'Ecuador', 'country_code': 'EC', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Ecuador'}, {'resource_name': 'geoTargetConstants/2222', 'id': '2222', 'name': 'El Salvador', 'country_code': 'SV', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'El Salvador'}, {'resource_name': 'geoTargetConstants/2250', 'id': '2250', 'name': 'France', 'country_code': 'FR', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'France'}, {'resource_name': 'geoTargetConstants/2276', 'id': '2276', 'name': 'Germany', 'country_code': 'DE', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Germany'}, {'resource_name': 'geoTargetConstants/2320', 'id': '2320', 'name': 'Guatemala', 'country_code': 'GT', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Guatemala'}, {'resource_name': 'geoTargetConstants/2340', 'id': '2340', 'name': 'Honduras', 'country_code': 'HN', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Honduras'}, {'resource_name': 'geoTargetConstants/2356', 'id': '2356', 'name': 'India', 'country_code': 'IN', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'India'}, {'resource_name': 'geoTargetConstants/2360', 'id': '2360', 'name': 'Indonesia', 'country_code': 'ID', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Indonesia'}, {'resource_name': 'geoTargetConstants/2372', 'id': '2372', 'name': 'Ireland', 'country_code': 'IE', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Ireland'}, {'resource_name': 'geoTargetConstants/2376', 'id': '2376', 'name': 'Israel', 'country_code': 'IL', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Israel'}, {'resource_name': 'geoTargetConstants/2392', 'id': '2392', 'name': 'Japan', 'country_code': 'JP', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Japan'}, {'resource_name': 'geoTargetConstants/2410', 'id': '2410', 'name': 'South Korea', 'country_code': 'KR', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'South Korea'}, {'resource_name': 'geoTargetConstants/2458', 'id': '2458', 'name': 'Malaysia', 'country_code': 'MY', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Malaysia'}, {'resource_name': 'geoTargetConstants/2484', 'id': '2484', 'name': 'Mexico', 'country_code': 'MX', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Mexico'}, {'resource_name': 'geoTargetConstants/2528', 'id': '2528', 'name': 'Netherlands', 'country_code': 'NL', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Netherlands'}, {'resource_name': 'geoTargetConstants/2554', 'id': '2554', 'name': 'New Zealand', 'country_code': 'NZ', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'New Zealand'}, {'resource_name': 'geoTargetConstants/2558', 'id': '2558', 'name': 'Nicaragua', 'country_code': 'NI', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Nicaragua'}, {'resource_name': 'geoTargetConstants/2578', 'id': '2578', 'name': 'Norway', 'country_code': 'NO', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Norway'}, {'resource_name': 'geoTargetConstants/2586', 'id': '2586', 'name': 'Pakistan', 'country_code': 'PK', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Pakistan'}, {'resource_name': 'geoTargetConstants/2591', 'id': '2591', 'name': 'Panama', 'country_code': 'PA', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Panama'}, {'resource_name': 'geoTargetConstants/2600', 'id': '2600', 'name': 'Paraguay', 'country_code': 'PY', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Paraguay'}, {'resource_name': 'geoTargetConstants/2604', 'id': '2604', 'name': 'Peru', 'country_code': 'PE', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Peru'}, {'resource_name': 'geoTargetConstants/2608', 'id': '2608', 'name': 'Philippines', 'country_code': 'PH', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Philippines'}, {'resource_name': 'geoTargetConstants/2630', 'id': '2630', 'name': 'Puerto Rico', 'country_code': 'PR', 'target_type': 'Region', 'status': 'ENABLED', 'canonical_name': 'Puerto Rico'}, {'resource_name': 'geoTargetConstants/2643', 'id': '2643', 'name': 'Russia', 'country_code': 'RU', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Russia'}, {'resource_name': 'geoTargetConstants/2710', 'id': '2710', 'name': 'South Africa', 'country_code': 'ZA', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'South Africa'}, {'resource_name': 'geoTargetConstants/2724', 'id': '2724', 'name': 'Spain', 'country_code': 'ES', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Spain'}, {'resource_name': 'geoTargetConstants/2752', 'id': '2752', 'name': 'Sweden', 'country_code': 'SE', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Sweden'}, {'resource_name': 'geoTargetConstants/2756', 'id': '2756', 'name': 'Switzerland', 'country_code': 'CH', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Switzerland'}, {'resource_name': 'geoTargetConstants/2804', 'id': '2804', 'name': 'Ukraine', 'country_code': 'UA', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Ukraine'}, {'resource_name': 'geoTargetConstants/2826', 'id': '2826', 'name': 'United Kingdom', 'country_code': 'GB', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'United Kingdom'}, {'resource_name': 'geoTargetConstants/2840', 'id': '2840', 'name': 'United States', 'country_code': 'US', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'United States'}, {'resource_name': 'geoTargetConstants/2858', 'id': '2858', 'name': 'Uruguay', 'country_code': 'UY', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Uruguay'}, {'resource_name': 'geoTargetConstants/2862', 'id': '2862', 'name': 'Venezuela', 'country_code': 'VE', 'target_type': 'Country', 'status': 'ENABLED', 'canonical_name': 'Venezuela'}].
Could you please help us to find the way to do it or to confirm that this is impossible? Because this thing is crucial for one part of our business logic.
Thank you in advance!
Tetiana