Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT /api/0.6/gpx/:id causes HTTP 500 Internal Server Error #4821

Closed
jmaspons opened this issue May 21, 2024 · 3 comments
Closed

PUT /api/0.6/gpx/:id causes HTTP 500 Internal Server Error #4821

jmaspons opened this issue May 21, 2024 · 3 comments

Comments

@jmaspons
Copy link

URL

No response

How to reproduce the issue?

While testing the R implementations of OSM API (osmapiR) I get a server error:

library(osmapiR)
gpx_path <- system.file("extdata", "St_Geroni.gpx", package = "osmapiR")
gpx_id <- osm_create_gpx(
  file = gpx_path,
  description = "Test create gpx with osmapiR.",
  tags = c("testing", "osmapiR")
)

gpx_upd_path <- system.file("extdata", "St_Geroni_70nodes.gpx", package = "osmapiR")
upd_trace <- osm_update_gpx(gpx_id = gpx_id, file = gpx_upd_path)
#> ! HTTP 500 Internal Server Error.
#> • The server encountered an internal error or
#> misconfiguration and was unable to complete
#> your request.
#> • Please contact the server administrator at
#>  webmaster@openstreetmap.org to inform them of the time this error occurred,
#>  and the actions you performed just before this error.
#> • More information about this error may be available
#> in the server error log.

The problematic API call is the PUT https://api.openstreetmap.org/api/0.6/gpx/:gpx_id
The body of the call is a gpx file:

<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="togpx">
  <metadata>
    <desc>Ruta circular des del Bruc a Sant Geroni, Montserrat</desc>
    <author>
      <name>Joan Maspons</name>
      <email id="joanmaspons" domain="gmail.com"/>
    </author>
    <copyright author="Joan Maspons">
      <year>2024</year>
      <license>http://opendatacommons.org/licenses/odbl/1.0</license>
    </copyright>
    <keywords>test file</keywords>
    <time>2024-05-21T12:02:27.755498390Z</time>
    <bounds minlat="41.5918039" minlon="1.7722108" maxlat="41.6128596" maxlon="1.7957907"/>
  </metadata>
  <trk>
    <name>El Bruc Trail Running</name>
    <desc>name=El Bruc Trail Running
time=1970-01-01T00:06:00.000Z</desc>
    <trkseg>
      <trkpt lat="41.59214297309518" lon="1.7731868382543325">
        <ele>575.7999877929688</ele>
        <time>1970-01-01T00:06:00.000Z</time>
      </trkpt>
      <trkpt lat="41.59229166805744" lon="1.7744414415210485">
        <ele>569.7999877929688</ele>
        <time>1970-01-01T00:06:54.000Z</time>
      </trkpt>
...
      <trkpt lat="41.596007784828544" lon="1.7722107656300068">
        <ele>617</ele>
        <time>1970-01-01T01:23:30.000Z</time>
      </trkpt>
      <trkpt lat="41.59213869832456" lon="1.773126320913434">
        <ele>576.2000122070312</ele>
        <time>1970-01-01T01:26:16.000Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Screenshot(s) or anything else?

No response

@tomhughes
Copy link
Member

You can't PUT a GPX file like that - that endpoint is for updating metadata on an existing trace and it takes a an osm XML object not a gpx object.

If you want to upload a new trace you should POST to /api/0.6/gpx/create and there's no way to replace the trace data for an existing trace.

@jmaspons
Copy link
Author

Thanks, @tomhughes. I misunderstood https://wiki.openstreetmap.org/wiki/API_v0.6#Update:_PUT_/api/0.6/gpx/#id. Will try to update the wiki

@tomhughes
Copy link
Member

It's basically the write version of the GET method at https://wiki.openstreetmap.org/wiki/API_v0.6#Download_Metadata:_GET_/api/0.6/gpx/#id/details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants