Can I search countries by country_code in AdWords API v201109? - google-ads-api

I want to find Country locations in AdWords API v201109 by country code, as it was possible in previous version of the API. However, in official documentation I can't find a way how to do that.
I can search by LocationName and entering country code. It works for some country codes ("CZ" - Czech Republic), but for some it doesn't ("SK" - Slovakia) - I suspect it doesn't work for most of country codes.
Of course, there's an obvious workaround: fetch Countries appendix and translate country codes to country names or ids locally. But I'd rather just search by country code directly. Is it possible?

Currently it is not possible to search countries by country_code only in AdWords API v201109. They havn't given feature for search with country code only. You are good hacky method.
They might develop later that for the same. Keep you code extend-able.

We recently published a CSV files that contains all the targetable locations, with a column for country code:
https://developers.google.com/adwords/api/docs/appendix/geotargeting

Related

Get specific category around city in Google Maps

I am using the Google Maps API and AutoComplete to make it easy for people to find restaurants around them. I have gotten this far but reading the documentation for it can be confusing. Is it possible to get a list of all the eating spots around Cupertino and if so how can it be achieved? Will I have to use SwiftyJson and or Alamofire in order to achieve this or does Google provides all the tools necessary to complete it?
Use Google Places API to get a list of all eating spots around the area. Achieve it by including the parameter types values to filter place searches.
Below is a sample code snippet how to use Place types:
Search specific place in city by given type:
https://maps.googleapis.com/maps/api/place/textsearch/json?query= [Search place Name]+in+[City Name]&type=[Place Type]&sensor=true&key= [API Key]
You can use type food and restaurant like type=food|restaurant
for more information how to use Place Types, here's the link: https://developers.google.com/places/supported_types

Rails Koala gem - get user's country

I'm using OmniAuth and the Koala gem to add Facebook Connect to my app and i'm trying to get the user's country.
So far I have:
graph = Koala::Facebook::API.new(user.oauth_token)
profile = graph.get_object("me")
profile["location"] gives me the id and name of the city.
I've tried: graph.get_object(city_id) which returns the city object, but I can't find any mention of the city's country in it.
I can also get the country name from the location string: "Kfar Saba, Israel" but that seems like a hack... Any official way to get what i'm looking for? Thanks!
There's the issue that the location data is not always complete for Place pages. I think you'll need to implement the location string parsing as a fallback if the location.country field of the Place page is empty. Be aware that the location string may also contain the location.state, which means that you'll have to use the last token after the split by comma.
Graph API returns no country for the named city:
https://developers.facebook.com/tools/explorer?method=GET&path=114269838585202&version=v2.0
See https://developers.facebook.com/docs/graph-api/reference/v2.0/page#readfields for the Page object structure.

google adwords api: how to get adgroupId in Keyword/Ad?

Based on code examples on google website I am able to fetch keywords and ads. The example prints something like this:
printf("Text ad with headline '%s' and id '%s' was found.\n", $googleAd->ad->headline, $googleAd->ad->id);
based on such field list which was fetched:
$selector->fields = array('Headline', 'Id')
Is it possible to get adGroupId as well ? I have been looking at documentation for TextAd, however I cannot see adGroupId in field list. I am afraid it is not possible, because adgroup has field called campaignId. Any help?
Yes, it is possible to get adgroup id. It is part of AdGroupAd type, and can be retrieved using "AdGroupId" as selector name. Then you would retrieve the field as $googleAd->adGroupId. More details here:
http://code.google.com/apis/adwords/docs/reference/latest/AdGroupAdService.AdGroupAd.html
In the future, I recommend that you ask the questions on the official AdWords API forum at http://code.google.com/apis/adwords/community/. The forum is pretty active, and AdWords API team members regularly answer developer questions on the forum.

g:countrySelect with full country name as value

I want to store the exact country name using g:countrySelect. Example Germany instead of DEU. It is the value in the drop down menu. The drop down text is Germany but when it saves it to the database it changes back to the country code. Sorry if I am somewhat naive but I have been searching for almost 3 hours for solutions and it isn't well documented at the grails website. I could opt for any alternative even ajax. Just to have an easy way to display a list of countries and will be able to store the REAL NAME of the country NOT country code. Thank you!
You can convert from an ISO3 country code to the country name using this function
def getCountryName(String countryCode) {
Locale.availableLocales.find{it.ISO3Country == countryCode}.displayCountry
}
// Test
println getCountryName('DEU') // prints 'Germany'
If you want to do this within a GSP, it would be best to make this available as a TagLib.
Not sure when the above solution stopped working but if you try that now, you'll get an error:
Couldn't find 3-letter country code for CS
With the latest grail version, the current way of getting the full country name is by using this tag:
<g:country code="${country}"/>
I know this thread is old, but I was looking for the same issue and I had to share my solution.
You can use the CountryTagLib object to convert the ISO3 code back to full country name like this :
def country = CountryTagLib.ISO3166_3[code]
The "code" property being the ISO3 code that you got from <g:countrySelect>.

how to get latitude and longitude for particular landmark?

how to get latitude and longitude for particular landmark/business, i would like to get lat/long for specific address how to i do that? shall i use gps device to get the lat/long?
Very recently, two or three weeks ago, Google released a new API that lets you do just what you want.
This is how it works:
http://maps.google.com/maps/api/geocode/format?address=some_address&sensor=true_or_false
And here is an example:
http://maps.google.com/maps/api/geocode/xml?address=Lenox+Hill&sensor=false
The format can be JSON or XML.
You will need to use a Geolocation API (such as Google or Bing or Yahoo), and there might be others as well. But those are the "free" (with caveats) ones that come to mind.
Just remember they have rather strict Terms-of-use of how you can use their API, so be sure you are on the right side of the law.
http://msdn.microsoft.com/en-us/library/cc981067.aspx
http://code.google.com/apis/maps/documentation/
Can you elaborate a bit more on that? What type of application is that? What is the format of the landmark/business? Basically there are geo web services out there that do this kind of stuff...
Have a look at this for example:
http://www.geonames.org/maps/us-reverse-geocoder.html
http://www.geonames.org/export/ws-overview.html
Yahoo http://developer.yahoo.com/geo/geoplanet/guide/concepts.html
You can query for a free-form name such as address, etc, and it will return what is called a WOEID, then query the WOEID for its lat long.

Resources