Thanks Derek. This is exactly the kind of response I was looking for. I didn't know how it was "in the real world" but I figured I wasn't the first person to think abou the problem. This seems like a reasonable solution. Thanks again.
On Tuesday, February 19, 2013 2:57:37 PM UTC-8, Derek wrote: > > Seems like a lot of hard work. Is your interface in production already but > you are going to make changes to it? First, i'd suggest you treat your API > as released and don't make changes to the parameters. If you do add > parameters, have defaults set for the new parameters. If you need to change > parameters completely, come up with a new method and depreciate the old > one. That's how they do it in the real world. > > If you don't want to treat your API as released, then your next option is > to have a new controller for a new version. So your old client gets /app/v1 > and your new client gets /app/v2 > > On Tuesday, February 19, 2013 3:50:05 PM UTC-7, Mike D wrote: >> >> Hi, >> >> I'm using web2py to serve RPC methods to a desktop client that a user can >> download. I'd like to know if anyone has any thoughts on a good way to >> version my API so that I can keep the older versions available for users >> that haven't updated their clients. >> >> As a starting point, I'm thinking of subclassing the Service class and >> adding a version number to the jsonrpc method (an additional argument to >> the decorator) so that I can have multiple functions with the same name and >> different versions. I'd then also override the serve_jsonrpc method, look >> up the appropriate version number from a header in the request, and find >> the appropriate function for that version in another lookup table I'll >> create myself. I'll then adjust the request so the name of the function >> includes that version number and then call the superclass serve_jsonrpc >> method. I'm trying to avoid having to copy each function into every new >> version of the API so that I can just fix any bugs in one spot. Any >> thoughts on this? Too hard? Won't work? >> >> If anyone has done this before and can help me out I'd appreciate it. >> >> Thanks, >> Mike >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.