[OSM-dev] Structured error messages from API

Matt Amos zerebubuth at gmail.com
Fri Dec 11 18:13:38 GMT 2009


On Fri, Dec 11, 2009 at 5:05 PM, Matthias Julius <lists at julius-net.net> wrote:
> Richard Fairhurst <richard at systemed.net> writes:
>
>> Tom Hughes wrote:
>>> Basically, even if sending a streaming response from rails was
>>> possible (which I'm not sure it is - it's certainly hard)
>>
>> You can do it using render :text=>proc, as amf_controller does. But I
>> suspect this would be non-trivial to work into the existing XML API.
>
> The API could also return an URL which the client can poll to get the
> status for an upload.
>
> This would also avoid issues with client timeouts.
>
> Currently, when the client hits a timeout and aborts the connection it
> has no way of knowing whether the upload succeeded or not.  For new
> data this creates duplicates when the user tries to upload again.

i have been thinking about something similar, which would work along
the following lines. the changeset is a container and POSTing a diff
to it returns a 202 Accepted result if diff processing takes more than
a few seconds. the result is a Location redirect to the individual
resource for the diff upload, which could be polled for status.

unfortunately, that's where it gets complicated. because the diff
upload occurs in a transaction, none of its outputs are visible until
it commits. therefore any status would need to be posted on a
different connection, in a different transaction. this makes things
annoying a messy. if anyone's got any ideas then i'd be very
interested to talk.

this is something that we can put into API 0.7 - which it might be a
good idea to start thinking about now, since the last API took about a
year to develop ;-)

cheers,

matt




More information about the dev mailing list