Hi! I'm just getting started with the Restlet framework, and have a few
questions. I'll start with one on trying to build web applications in a
RESTful way.

But first, let me thank you guys for building this. As somebody who has
used Servlets for many years and kinda resented them for nearly as long, I
really appreciate how much cleaner and more symmetrical the Restlet
framework is. It's like a dreary rain stopping, with the sun peeking
through the clouds.

Thanks also for the nice documentation. The FAQs and tutorial examples
were particularly helpful to me.


That said, here's my question.

I am going to build an Ajax-y web-app, which will naturally mix
traditional page rendering with API calls. Many of my resources will need
to be represented both ways. Ideally, I'd like to do this with one set of
URIs; duplicating everything under /api/ seems suboptimal to me.

Given that, I'm having trouble creating resources using POST. Suppose I
POST a new order to

    http://example.com/order/

The server would then create the order, give it an order number, and tell
the client where to find it:

    http://example.com/order/1234567890

 Then the client can look at the resource and display it to the user.

If I'm dealing with an API, then I'd return a "201 Created" and put in a
Location header. The client could then go fetch that. For a browser,
though, I want them to go look at the order, so I'd be inclined to send a
301 redirect to that same location.

I can think of a few ways around this conflict, but I don't like any of
them all that much. So I'll just ask: what do you do when you want to
return  one result code to an API, and another to a browser?

Thanks,

William

-- 
William Pietri - [EMAIL PROTECTED] - +1-415-643-1024
Agile consulting, coaching, and development: http://www.scissor.com/
Instant video gratification: http://www.sidereel.com/

Reply via email to