[OSM-dev] Structured error messages from API

Matthias Julius lists at julius-net.net
Fri Dec 11 16:50:15 GMT 2009


Karl Guggisberg <karl.guggisberg at guggis.ch> writes:

> For JOSM, the structured data currently "embedded" in the error message is
> important. Examples are object ids of already deleted objects (410 Gone) or
> a date (the close date of a changeset in a 409 Conflict).
>
> I'd prefer a parseable error document in case of http error codes,
> preferably in XML. This would not be much of a change because the content of
> the 'Error' http header is already replied as error document too (sometimes
> for some error cases). 
>
> It would be nice if the OSM API replied a message in english *and* and in
> the language supplied in the "Accept-Language" http header. 
>
> Example:
> <osm-api-error>
>   <error-id code="1232" /> <!-- unique error code? would be nice too -->
>   <message lang="en">Upload of an object failed.</message>
>   <message lang="de">Hochladen eines Objekts ist fehlgeschlagen.</message>
>   <property name="object-id" value="1223"/>
>   <property name="closed-date" value="...."/>
> </osm-api-error>

XML is probably the best solution because it is flexible and anybody
communicating with the API knows how to pars XML anyway.

Any objections against changing the body of the error document from
the current text string (which is a duplicate of the Error header,
AFAICT) to a XML document?

Anybody interested in helping to come up with a specification for
this?

Matthias




More information about the dev mailing list