I totally agree with ivan and julio. Great advice.
On a related note, one idea that I've found helpful (if you want to provide a public api) is to document how your api works through cucumber features. The idea being that consumers of your API can be sure that your API does what it says it will, and saves you having to write documentation *and* maintain tests (I got that idea from Anthony Eden of DNSimple). Think of your third party developers as stakeholders I guess. Iain On 1 June 2012 09:13, Samuel Richardson <[email protected]> wrote: > Theirs been a few attempts at creating a standardised format, one is: > > http://labs.omniti.com/labs/jsend > > with a gem available: > > https://github.com/utahstreetlabs/jsend-rails > > Implemented on a recent project here and it seems to be quite flexible. > > Samuel Richardson > www.richardson.co.nz | 0405 472 748 > > > > On Fri, Jun 1, 2012 at 9:07 AM, Julio Cesar Ody <[email protected]>wrote: > >> > We still return per_page in our API calls as we have limits on what >> > the client can request. So although a client my request a page size of >> > 200 for load management and performance reasons we may only accept >> > values of 50 (for example). >> >> I quote myself: >> >> > and in which case, it should accept a range value, or two values, one >> for range beginning and range end. The >> > gist here being that some clients might find it suitable to fetch more, >> others less, and your API should simply >> > let those clients decide that. Probably up to a certain number of >> posts, of course. >> >> As for what Ivan suggested, working backwards from what you'll need >> works, yes, and probably if said API will be consumed first and >> foremost by JS, then go for that and make changes as you need them >> should mobiles or whatever come next. I assume you have a budget/time, >> so that helps that. >> >> Oh and about "semantics" in APIs, the fact is an array is a structure >> where the length equals the number of entities it carries. So turning >> a collection into an object just so it can carry metadata which can >> obviously be extracted from this characteristic of the collection >> doesn't make anything more semantic, but just repetitive. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby or Rails Oceania" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rails-oceania?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
