I have a Restful web service. Reservation room can change. Which URI is better solution?
a) http://localhost/hotel/Xhotel/Reservation/15
I have a Restful web service. Reservation room can change. Which URI is better solution?
a) http://localhost/hotel/Xhotel/Reservation/15
That depends only on your requirements.
For example if a reservation can span multiple rooms then options b) and c) wouldn't be good URLs to access the full reservation.
Another question is if your reservation IDs are unique among all rooms or if the room ID is needed as well to uniquely identify a reservation.
First of all you write RESTful. REST is an abbreviation.
Second, imo you should access them by Reservation ID so the first option is the best.
Reservation (Unique Key: Reservation ID) has many Rooms (Forign Key: Reservation ID).
Use the second option to see what reservations are on a specific room.
Also you can use the third option to show data about a room in the reservation.
Each representation of the resource should only have a single URI. If the reservation is the important part, and the room can change, then don't include the room number in the URI. However, REST doesn't particularly care what your URIs look like, as long as you follow its constraints.