3

I have a database schema with Reservations and Products.

A reservation can have multiple products and a product can have multiple reservations. A reservation can also have a product multiple times. I have a many-to-many relation set-up for this, which works well.

Now I'm porting this schema over to my Backbone application where I use a BackboneRelational setup having a Reservation model, ReservationProduct model and a ReservationProducts collection. In My Reservation model i defined a hasMany link to ReservationProducts.

All works fine but I'm wondering which RESTful routes I should use for a PUT or DELETE call on a Product.

I'm wondering how I should deal with the the fact that a reservation can have a product multiple times.

Would a DELETE call for example be pointed at

/reservation/:reservation_id/product/:reservation_product_id
(This is the one backbone generates for me)

or this one:

/reservation_product/:id

?

And if so, which RESTful route is correct:

/reservation/:reservation_id/product/:reservation_product_id

/reservation/:reservation_id/product/:product_id

tomvo
  • 1,409
  • 1
  • 12
  • 21

0 Answers0