Node deletion request: Bad Request

Hi,

I’m having some problem to delete a node using the OSM API
http://wiki.openstreetmap.org/wiki/API_v0.6#Delete:DELETE.2Fapi.2F0.6.2F.5Bnode.7Cway.7Crelation.5D.2F.23id

I can successfully create new nodes (open changeset, create node, closing changeset)

If I understand correctly the delete procedure should be very similar to it (open changeset, delete node, closing changeset) with the exception that the request is a DELETE instead of a PUT, the URL is slightly different (/api/0.6/node/#id instead of /api/0.6/node/create), and the XML data is different (see below).

The osm server returns a “Status: 400 Bad Request” with the following explanation:
“Error: Cannot parse valid node from xml string . Must specify a string with one or more characters”
This same error occurs when i’m passing an empty xml string or omitting the xml data of the node to be deleted.

This is the xml i’m passing to the request on CREATE a new node:

NODE_CREATE_XML =
“”"






“”"

and this is the xml for the DELETE node request:

NODE_DELETE_XML =
“”"



“”"

This is how the CREATE request is submitted:

requests.put(OSM_API_BASE_URL + ‘node/create’,
auth=HTTPBasicAuth(key.OSM_ID, key.OSM_PW),
data=NODE_CREATE_XML.format(lat, lon, changeset_id, node_comment, amenity_type)
)

and this is how the DELETE request is submitted:

requests.delete(OSM_API_BASE_URL + ‘node/’ + node_id,
auth=HTTPBasicAuth(key.OSM_ID, key.OSM_PW),
data=NODE_DELETE_XML.format(lat, lon, node_id, version, changeset_id)
)

What am I doing wrong?

Thanks in advance for your help.

Federico