Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Ian Clarke
I'm implementing Resource.put(), and I want to standardize on JSON as my data representation language. This resource is a User object called 'u', that contains one main field, a Set of Integers called tags. Can someone let me know if I'm doing this right, and in the idiomatic manner - or if I

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Rob Heittman
Hi Ian, At my outfit, when we've written elaborate REST API documentation, evidence indicates hardly anyone reads it :-) I've had the best results with documentation by example ... to start with, write out a few examples of the actual representation in likely use cases, and if time permits,

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Ian Clarke
Hi Rob, Thanks for the feedback. I certainly agree that examples are often the best form of documentation. But, my particular concern was, how do I explain, in a language (and library) neutral way, how to send a JSON object to a resource via a HTTP PUT request. I'm also concerned to ensure

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Rob Heittman
I'll let someone who uses JSON more than me answer about the idiom of the JSON traversal, but it looks OK to me. If you are using the 1.1 Restlet API, you want to override storeRepresentation() instead of put(). For my 2 cents, I don't think you need to explain the HTTP PUT operation. Whatever

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Ian Clarke
I'm using Restlet 1.0.8 - would you recommend using 1.1? How stable is it relative to 1.0.8 - and what are the benefits? Does the use of methods like getRepresentation() and storeRepresentation() not cause a problem because they decouple Restlet from the underlying HTTP protocol terminology?

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Kevin Conaway
Hi Ian, I believe you should override Resource.storeRepresentation() and override Resource.allowPut() - true instead of overriding Resource.put() As for your documentation concerns, I would explain that sending JSON is no different than sending any other text-based request entity. You should

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Ian Clarke
On Mon, Mar 24, 2008 at 10:07 AM, Kevin Conaway [EMAIL PROTECTED] wrote: I believe you should override Resource.storeRepresentation() and override Resource.allowPut() - true instead of overriding Resource.put() I don't think there is a Resource.storeRepresentation() method in 1.0.8. Are you

Re: Submitting JSON object to Resource via a HTTP PUT

2008-03-24 Thread Kevin Conaway
I don't think there is a Resource.storeRepresentation() method in 1.0.8. Are you recommending this because my approach won't work, or because .storeRepresentation() is better in some way? You are correct, sorry for the confusion. In 1.1, the correct method to override is