This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

API test call

0

Trying to get this to work in the test environment and keep getting connection failure. Is there a test API for Geocoding with http?

<cfhttp method="get" url="https://nominatim.openstreetmap.org/search?city=oxford,&amp;country=New Zealand&amp;format=geojson" getasbinary="never"> <cfoutput> <cfdump var="#cfhttp.filecontent#"> </cfoutput>

asked 20 Jun '19, 02:51

LoganOSM's gravatar image

LoganOSM
11112
accept rate: 0%

How do I create User-Agent identifying the application so API call will work?

(05 Jul '19, 15:13) LoganOSM

How will depend on how you're making the https call. Is that via a web framework for a particular environment or language, or something else?

Edit: Richard has spotted that you're using Cold Fusion - best to follow his suggestion.

(05 Jul '19, 16:19) SomeoneElse ♦

User-agent still not working. Can I provide an IP address to you to be granted permission? Or do you have one sample call that uses address to obtain lat/lng in geocode that does not require useragent or valid HTTP referer?

(08 Jul '19, 15:25) LoganOSM

One Answer:

1

Read the Nominatim usage policy:

https://operations.osmfoundation.org/policies/nominatim/

You need to "Provide a valid HTTP Referer or User-Agent identifying the application (stock User-Agents as set by http libraries will not do)". If you do not, then it's very likely your requests will be blocked.

(Learning how to set a user-agent in ColdFusion is outwith the scope of this help site and you'd probably need to ask on a ColdFusion support site.)

answered 20 Jun '19, 12:04

Richard's gravatar image

Richard ♦
30.9k44279412
accept rate: 18%

Source code available on GitHub .