Fiji comes back as one country - no weather and bad query

  • 1
  • Question
  • Updated 6 years ago
Using the search API for Fiji we get the following JSON (parsed into NSDictionary):

$0 = 0x14d255a0 (
{
c = FJ;
l = "/global/FJ.html";
name = Fiji;
type = country;
tz = MISSING;
tzs = MISSING;
zmw = "000FJ.1.99999";
}
)

And of course when using the location search as part of the URL:
http://api.wunderground.com/api/mykey...

{
response = {
error = {
description = "you must supply a location query";
type = invalidquery;
};
features = {
};
termsofService = "http://www.wunderground.com/weather/a...";
version = "0.1";
};
}

But if I go to the WU website and type in Fiji, I do get a page of cities. Why doesn't the search show the cities properly?
Photo of Alex K

Alex K

  • 14 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
What's the API endpoint you use for "search"?

The geolookup feature, for example/geolookup/q/Fiji.json returns a rich ready-to-use response like this

{
"response": {
"version": "0.1"
,"termsofService": "http://www.wunderground.com/weather/api/d/terms.html"
,"features": {
"geolookup": 1
}
, "results": [
{
"name": "Lakemba",
"city": "Lakemba",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91691",
"l": "/q/zmw:00000.1.91691"
}
,
{
"name": "Lambasa",
"city": "Lambasa",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91657",
"l": "/q/zmw:00000.1.91657"
}
,
{
"name": "Laucala Bay",
"city": "Laucala Bay",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91690",
"l": "/q/zmw:00000.1.91690"
}
,
{
"name": "Lautoka",
"city": "Lautoka",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91679",
"l": "/q/zmw:00000.1.91679"
}
,
{
"name": "Levuka",
"city": "Levuka",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91678",
"l": "/q/zmw:00000.1.91678"
}
,
{
"name": "Matei",
"city": "Matei",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91665",
"l": "/q/zmw:00000.1.91665"
}
,
{
"name": "Matuku",
"city": "Matuku",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91697",
"l": "/q/zmw:00000.1.91697"
}
,
{
"name": "Nadi",
"city": "Nadi",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91680",
"l": "/q/zmw:00000.1.91680"
}
,
{
"name": "Nambouwalu",
"city": "Nambouwalu",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91659",
"l": "/q/zmw:00000.1.91659"
}
,
{
"name": "Nausori",
"city": "Nausori",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91683",
"l": "/q/zmw:00000.1.91683"
}
,
{
"name": "Ono-I-Lau",
"city": "Ono-I-Lau",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91699",
"l": "/q/zmw:00000.1.91699"
}
,
{
"name": "Rakiraki",
"city": "Rakiraki",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91669",
"l": "/q/zmw:00000.1.91669"
}
,
{
"name": "Rotuma",
"city": "Rotuma",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91650",
"l": "/q/zmw:00000.1.91650"
}
,
{
"name": "Savusavu",
"city": "Savusavu",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91663",
"l": "/q/zmw:00000.1.91663"
}
,
{
"name": "Sigatoka",
"city": "Sigatoka",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91682",
"l": "/q/zmw:00000.1.91682"
}
,
{
"name": "Suva",
"city": "Suva",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91689",
"l": "/q/zmw:00000.1.91689"
}
,
{
"name": "Undu Point",
"city": "Undu Point",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91652",
"l": "/q/zmw:00000.1.91652"
}
,
{
"name": "Vanua Balavu Island",
"city": "Vanua Balavu Island",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91676",
"l": "/q/zmw:00000.1.91676"
}
,
{
"name": "Viwa Island",
"city": "Viwa Island",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91670",
"l": "/q/zmw:00000.1.91670"
}
,
{
"name": "Vunisea",
"city": "Vunisea",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91693",
"l": "/q/zmw:00000.1.91693"
}
,
{
"name": "Yasawa-I-Rara",
"city": "Yasawa-I-Rara",
"state": "",
"country": "FJ",
"country_iso3166":"FJ",
"country_name":"Fiji",
"zmw": "00000.1.91660",
"l": "/q/zmw:00000.1.91660"
}
]
}
}
Photo of Alex K

Alex K

  • 14 Posts
  • 0 Reply Likes
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
If the wanted scenario is to get a batch condition response for a whole area I don't think it's supported at the moment. The returned autocomplete response itself has a "dummy" value, since queries can't be done by countries.

An improvement for united states (as seen in a similar topic in http://apicommunity.wunderground.com/... ) is expected from this summer, but don't know if the update will be global.
Photo of Alex K

Alex K

  • 14 Posts
  • 0 Reply Likes
No, what I'm looking for is every result from the autocomplete API to return something that is usable. If its not usable as a query, it shouldn't come up.
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 123 Reply Likes
I get what you mean about the autocomplete. It has to do with it being a shared resource with our site. I'll see if there's something that can be done.