[openstreetmap/openstreetmap-website] opewnstreetmap api (Issue #3507)

John-David Deubl notifications at github.com
Tue Mar 22 12:50:03 UTC 2022


### Description

Hello,

I'm trying to load the content of a file with the osm api to display it in a web app, but I'm getting a 302 error.

`TypeError: NetworkError when attempting to fetch resource. `
is it only possible to download the file and not just load the content of the file witrh .blob() ?

```

  let osm_server_load_gpx = function (id) {
    let n = "Bearer " + localStorage.getItem("openstreetmap_token");

    const myHeaders = new Headers({
      Authorization: n,
    });

    return fetch("https://api.openstreetmap.org/api/0.6/gpx/" + id + "/data", {
      method: "GET",
      headers: myHeaders,
      redirect: "follow",
    })
      .then((response) => response.text())
      .then((data) => {
        console.log("data:" + data);
      })

      .catch((error) => {
        alert("error: " + error);
      });
  };
```





### Screenshots

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3507
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/3507 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220322/f3d0a221/attachment.htm>


More information about the rails-dev mailing list