Question

I have a resource structure like flight > seat > reservation, so a reservation belongs to a certain seat which belongs to a certain flight:

http://example.com/jdf_3prGPS4/1/jMBDy46PbNc
                   ----------- - -----------
                        |      |       |
                        |      |       |
                     flight  seat  reservation

Since the customer gets this (somewhat ugly) URL for later cancellation I consider to leave out the resource structure and shorten the link to the reservation:

http://example.com/reservation/jMBDy46PbNc                     

Do you see any reasons (relevant to the user) not to shorten this URL?

Was it helpful?

Solution

The end user doesn't much care what the urls structure is. In fact given what they look like there they almost certainly don't even want to look at them and instead just clicky-click. This only really leaves functional considerations.

If the URLs lead to exactly the same resource and that resource behaves exactly the same with the different urls then almost by definition it doesn't matter which one you use.

I guess the only real factor might be whether there are any security implications. Would I be able to guess reservation IDs? Does that get me anywhere (ie would I still need to log in or something)? If there is a seat and flight as well they would have to be able to guess a valid combination of all three which is obviously a lot harder than just brute forcing the reservation ID.

If this last is not a concern then I don't see any reason to ever use the longer url...

OTHER TIPS

Whether you offer the longer or shorter URL is not a big issue, but whether you offer only one of them or both of them is. If both URL's return the same content, then you will have duplicate information in your caches (whether server-side, intermediary, or client-side), and these can get out of sync between the two resources, especially if they are cached at different lifetimes. Ideally, you should offer one or the other. If you really want to offer both, you should have one redirect to the other instead of duplicating it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top