Sharing URLs in a web application

Here is the problem I need to solve. I have a web application that basically allows the user to query some server data source and see the query results - a kind of reporting application. A query can be created by the user by specifying values ​​for several predefined parameter types. Suppose A1 .... AN is a list of possible parameters, so the query will look like this: A1 = "some_value" & A2 = "some_other_value" & ... & AN = "whatever" *. I need a way to share these requests between app users, a kind of “bookmark feature”. I can foresee two different approaches that can be used to solve this problem:

  • Include request in URL. So I would have something like * http://www.myapp.com/q=possibly_very_very_very_long_string* as a URL that can be shared between people. Personally, I do not like this approach. A long URL can be messy. Sending it by e-mail or any other transport, copying / pasting, etc., of course, will lead to poor user experience.

  • Use server memory to map these long "URLs" to some more user-friendly ones. A trivial example would look something like this: http://www.myapp.com/q=12345, where 12345 will be the identifier of this request in the application database. This approach looks more attractive to me.

What do you think about this? Maybe I missed something?

+5
source share
2 answers

Your second sentence sounds like the best I can see.

What you might think is to change the structure of your URL. Perhaps you can remove the regular URL if you know what to expect from each parameter. If the parameter length is constant, you can pass everything as one long parameter.

+2
source

I would also prefer your second option. Another option is to use a shortened Google URL or similar.

+1
source

All Articles