如何使用 OSM API 版本 0.6 和 curl 删除 OpenStreetMap 中的节点

How to delete a node in OpenStreetMap with the OSM API version 0.6 and curl

起初,尽管有关于版本 0.6 的警告,我还是尝试 the instructions in the official wiki of OpenStreetMap

当想下载节点数据但删除节点无效时,建议的方法仍然有效:

curl -u username:password -X DELETE 'https://api.openstreetmap.org/api/0.6/node/6345940173'

The documentation of the API 表示 "Expects a valid XML representation of the element to be deleted"。我还需要做些什么才能让它发挥作用?

我最后一次尝试没有成功:

curl -u username:password -X DELETE 'https://api.openstreetmap.org/api/0.6/node/6345940173' -T delete.xml

delete.xml:

<?xml version="1.0" encoding="UTF-8"?><osm><node id="6345940173" version="1" changeset="68272837" lat="48.8647893" lon="2.4283983"></node></osm>

它只是告诉:

The changeset 68272837 was closed at 2019-03-18 21:01:43 UTC

当我使用 echo -ne username:password|base64 --wrap 0 和调用 curl -H "Authorization: Basic <my_token>" -X DELETE 'https://api.openstreetmap.org/api/0.6/node/6345940173' -T delete.xml.

自行编码凭据时,我得到了相同的结果

无法删除变更集,因为它是不可变的。感谢 mmd 提供此信息。您可以通过仔细查看下图来了解原因:

但是,我最后一次尝试使用的语法似乎是正确的,应该可以与其他请求方法(PUT,POST)一起使用。