This is going to be a web service that returns a JSON object. Currently, I'm using C# technology and simply using ASP.Net MVC to create the calls. This is not a web page, so SEO is not a concern.
I've come across a number of instances where I want to get the "next" or "previous" item in a list. For example, I've got a service that returns a featured photo. http://myservice.com/photos/123 which returns a JSON
{"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg"}
The client (Ajax, Mobile device, etc.) of this service wants to know what the “next” item is going to be. I’m struggling about what the url should be.
- http://myservice.com/photos/123/next
- http://myservice.com/photos/next/123
- http://myservice.com/nextphotos/123
or maybe the id property should just be a parameter
http://myservice.com/photos/next?photoId=123
Or maybe this is entirely wrong and it should be like
http://myservice.com/photos/?method=getNextPhoto&photoId=123
though with .Net's routing, it might be easier to write it as http://myservice.com/photos/method/getNextPhoto?photoId=123
I’m relatively new to web services and REST. I get the basic CRUD for REST, but I don’t know what is the best practice for creating more custom urls, in this case the “next” photo. Is there an accepted RESTful practice?