peej/tonic — Issue #54: Not so restful URI configuration
Author: Ismael-Hery
Created: 2011-10-27 15:41:50+00:00
State: open

Hello,

thanks for this nice REST API.

IMHO URI configuration doesn't allow for basic REST resource management. For instance I'd like to have the following mapping for a photos resource:

GET /photos/:photoId => get an existing photo
POST /photos => create a new photo

with some code like :

/**
* @uri /photos/:photoId
*/
class PhotoResource extends Resource {

public function get($request,$photoId){
......
}

public function post($request){
.......
}

But the following code gives "A resource matching URI "/photos_service/photos" was not found" when trying to POST to /photos since it seems to require a photoId URL parameter for all access to this resource.

Maybe I missed something since this approach is possible with Rails or in JSR 311 like below.

@Path(“/customers”)
public class CustomersResource {

@GET
@Path(“/{email}”)
public Customer getCustomer(@PathParam(“email”) String emailAddress)
{…}

In both rails and JSR311 ways it requires to have lattitude to configure URL at the method/verb level.

Do you have an idea ?

Regards,

Ismaël