Some Geo search returns empty string for country_code

targeting
search
geo

#1

https://api.twitter.com/1.1/geo/search.json?granularity=country&query=rico

Returns

{
  "result":  {
    "places":  [
       {
        "id": "48c0e174396d2cbf",
        "url": "https://api.twitter.com/1.1/geo/id/48c0e174396d2cbf.json",
        "place_type": "country",
        "name": "Puerto Rico",
        "full_name": "Puerto Rico",
        "country_code": "",
        "country": "Puerto Rico",
        "contained_within":  [],
        "centroid":  [
          -66.3854856946198,
          18.199755000000003
        ]
      }
     ]
   }
}

In Puerto Rico, the country_code is empty.

Where others have the country_code for tweet targeting:

{
  "result":  {
    "places":  [
       {
        "id": "6416b8512febefc9",
        "url": "https://api.twitter.com/1.1/geo/id/6416b8512febefc9.json",
        "place_type": "country",
        "name": "United Kingdom",
        "full_name": "United Kingdom",
        "country_code": "GB",
        "country": "United Kingdom",
        "contained_within":  [],
        "centroid":  [
          -1.9280975903801871,
          54.3306827
        ]
       }
    ]
  }
}

Is empty country_code expected?

Thanks.


#2

From this query, do you also receive:

{
        "id": "6a050a2773fd3cc4",
        "url": "https://api.twitter.com/1.1/geo/id/6a050a2773fd3cc4.json",
        "place_type": "admin",
        "name": "Puerto Rico",
        "full_name": "Puerto Rico, USA",
        "country_code": "PR",
        "country": "United States",
        "contained_within":  [
           {
            "id": "96683cc9126741d1",
            "url": "https://api.twitter.com/1.1/geo/id/96683cc9126741d1.json",
            "place_type": "country",
            "name": "United States",
            "full_name": "United States",
            "country_code": "US",
            "country": "United States",
            "centroid":  [
              -98.99308143101959,
              36.890333500000004
            ],

#3

Hi,

Nope, by looking at the place_type, the one you have is from this query:

https://api.twitter.com/1.1/geo/search.json?granularity=admin&query=rico where granularity is admin.

If the granularity is country, then the only search result for Puerto Rico is the one I have with empty country_code (place id: 48c0e174396d2cbf).

Question is should we always prefer granularity=admin over country?