GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
API: multiple featureCode parameters  XML
Forum Index -> General
Author Message
drzraf



Joined: 10/06/2010 11:27:15
Messages: 19
Offline

Hi, in the search API I would like to provide multiple featureCode (the PCL*)
But when using the autocomplete jQuery API the request issued is in the form :
http://ws.geonames.org/searchJSON?featureCode[]=PCLS&featureCode[]=PCLI&...
what is quite correct according to the HTTP specification but isn't accepted by geonames.
Would you consider supporting this way of passing multiple values to an argument ?
geotree


[Avatar]
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline

You are right : this syntax should work.
@Marc : is it easy to implement ?

If you need to get all countries, use countryInfo webservice :
http://www.geonames.org/export/web-services.html#countryInfo

Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html
[WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

are you sure this is correct? I can't find any reference to this notation with square brackes [] except for one or two php examples. The service is using java servlet and they don't seem to support this notation.

Marc

[WWW]
drzraf



Joined: 10/06/2010 11:27:15
Messages: 19
Offline

That's right, the syntax to pass the parameter multiple-values to the servers is specified by the HTML spec : appending [] to the field "name".
(http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1)

How the server should handle this isn't specified as it just depends on the server-side language.
AFAIK the HTTP spec, doesn't talk about that (it's probably outside its scope unlike I previously asserted)

If its hard (or not wanted) to implement to support on the java servlet side, I will ask on the jQuery side for an option to support the "non-HTML" notation.

Thanks for the answers.
geotree


[Avatar]
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline

What about a RegExp syntax using "|" ?
http://ws.geonames.org/searchJSON?featureCode=PCLS|PCLI

Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html
[WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

drzraf: I don't find any reference to '[]' on the page you link to.

The service already supports multiple parameters:
http://ws.geonames.org/search?q=london&maxRows=10&featureCode=PPLC&featureCode=PPL

Just the brackets behind the parametername are not supported.

[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team