Author |
Message |
31/07/2006 11:50:33
|
Anonymous
|
URL: ws.geonames.org/gtopo30? only gives output in plain text, no JSON choice.
I plan to use this kind of service on a Google Maps mash-up for site investigation application. I can not make use of it easily if it is in plain text.
Please add JSON (with callback option) output for this service. Thanx in advance.
Best Regards,
swatchai
|
|
|
31/07/2006 20:12:57
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
Hi Swatchai
Here it is :
http://ws.geonames.org/gtopo30JSON?lat=47.01&lng=10.2
all our JSON services have the callback option and an option formatted for pretty printing.
Marc
|
|
|
|
01/08/2006 09:43:29
|
swatchai
Joined: 31/07/2006 12:30:39
Messages: 1
Offline
|
That's great!
Thanks again for your great works.
Best Regards,
swatchai
|
|
|
12/01/2007 15:48:02
|
daveky
Joined: 12/01/2007 15:43:15
Messages: 2
Offline
|
Hi. I was about to request both of these things. Good job I searched the forum. I would like to thank all involved for this great service!
However, I can't see how to get responses with a mime type of text/javascript and not just text/plain. Is it possible? Shouldn't it really be text/javascript as that's what the response is?
Cheers, DaveK.
|
|
|
15/01/2007 18:06:32
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
Hi DaveK
According to the JSON rfc the mime type should be "application/json" :
http://www.ietf.org/rfc/rfc4627.txt?number=4627
I have changed it to mime type "application/json", but I am not very happy with it. It is getting a little bit annoying to open the file in a browser and with IE I get an error message and cannot open it at all. Do you have an idea why IE doesn't allow me to open it?
Mime type "text/plain" has one big advantage that it can be easily viewed with a browser. Are there any advantages for mime type "application/json"? If not I will change it back to "text/plain".
Regards
Marc
|
|
|
|
15/01/2007 18:31:35
|
daveky
Joined: 12/01/2007 15:43:15
Messages: 2
Offline
|
application/json is to the specification (I did not know that) but as text/javascript you would at least be able to open it automatically in Firefox if not IE and it is javascript after all. As text/plain both browsers allow viewing.
I was just suggesting it for correctness. I'm not a stickler for correctness for it's own sake and I have to agree with you; it was much better as text/plain. It is useful to view the response in a browser. But then, in reality, I guess very few people would/should actually use it this way in anger!
I guess one day the mime type might make a difference (it should now, and might do to server side scripts calling your service) but as it probably doesn't changing it back is the way to go.
Thanks for you reply and all your work on this.
Cheers, D.
|
|
|
15/01/2007 20:17:30
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4416
Offline
|
I am glad we agree and have changed it back.
Thanks.
Marc
|
|
|
|
|