Fetch JSON output from HTTP link withoud .json extension

I am working on a project which involves geocoding.
Now I would like to use the JSON output of a link.
Unfortunately, when I try to log the output in the terminal, it just prints the link itself.

This is my code:

console.log("https://nominatim.openstreetmap.org/search?q=BASF&limit=1&format=json")

Thanks in advance.

(post deleted by author)

(post deleted by author)

That wouldn’t resolve my issue as the HTTP link would still have to end in .json.

That wouldn’t resolve my issue as the HTTP link would still have to end in dot json.

Sorry for not being descriptive enough.
What I meant was that even simple fetch requests like these don’t work:

fetch('https://nominatim.openstreetmap.org/?addressdetails=1&q=bakery+in+berlin+wedding&format=json&limit=1')
        .then(response => response.json())
        .then(json => console.log(json))

I just figures out what the problem was. I requested too many requests at once and further requests from my IP got baned for a short time period.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.