javascriptjsongeocodingnominatim

Fetching JSON Data from Nominatim API is not working


I am working on a project which requires geocoding with the Nominatim API. Requests like these work in the browser but they do not work in this fetch() function in JavaScript:

fetch('https://nominatim.openstreetmap.org/search?q=Germany&format=json&limit=1')
        .then(response => response.json())
        .then(json => console.log(json))

Does not work.

Other links to other APIs work though:

fetch('https://jsonplaceholder.typicode.com/todos/1')
        .then(response => response.json())
        .then(json => console.log(json))

Works.

I am using Node.js v18.12.1 in VS on Fedora 37.

I already tried other ways of writing this fetch() function.


Solution

  • The Nominatim API seems to have a limit for the number of API requests in a certain time frame.

    Not requesting to many requests at once solved my problem.