[OSM-dev] API id placeholders

Frederik Ramm frederik at remote.org
Sun May 6 09:15:18 BST 2007


> Couldn't the OSM API be made to accept negative ID numbers as 
> placeholders in this fashion, and to allow multiple objects (e.g. 
> these two nodes and one line segment) in one request?  Would that 
> terribly break some rule in the REST bible?
> Sometimes when I need to change the direction of every line 
> segment in a long way, or want to change or remove an attribute 
> from a large number of objects

Both topics are not really related - your "update many objects at once" 
request could be met even without the "negative numbers as placeholders" 

The problem with both is return values. If you send a request that is 
intended to update many objects at once, and one fails (e.g. because the 
object you intend to update has been deleted in the mean time), then how 
will you know which one failed? The API doesn't use or support 
transactions, so it cannot roll back the database to whatever state it 
was in before it started processing your multi-update. One would have to 
devise a more complex return value indicating a position within the 
request where the failure occurred.

With object creation failure situations are even more complex, but even 
if everything goes well you (or your editor) needs to know which IDs 
were actually assigned to each of the new objects, so the return value 
would have to be some sort of mapping table "node -1 -> 1234567".

All not impossible, but not easy either. And, while there's no reason to 
be fanatic about anything, the idea behind REST is usually to have calls 
that work with one object and not with a collection.


Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'

More information about the dev mailing list