1

Is there harm ind doing so? Sometimes, I want to retrieve data parameters are too long and I don't want it to show in my URL so I use POST. Should I not be doing this? If so, for the case that I mentioned, how would you go about the long query string?

g_b
  • 11,728
  • 9
  • 43
  • 80
  • 1
    Technically, you can do this safely. Semantically, you should use `GET` for requests that simply retrieve information and do not effect a change of state, and `POST` for requests that change the server state in some way. –  Nov 21 '14 at 01:37
  • Duplicate: http://stackoverflow.com/questions/504947/when-should-i-use-get-or-post-method-whats-the-difference-between-them – Leandro Bardelli Nov 21 '14 at 01:38
  • Do you have a sample `GET` with parameters? Maybe there's a way to refactor your URL. – Jacob Nov 21 '14 at 01:39

1 Answers1

2

The inability for caching to take place is one disadvantage. Another is that it may violate the principle of least surprise; people expect GET for getting data usually.

To avoid a long query string, one approach is to consider whether it makes sense to integrate your parameters into your path instead of query string parameters.

Jacob
  • 77,566
  • 24
  • 149
  • 228
  • It depends on how long it is. Something longer than 2k may still be reasonable (due to a problem domain) but already causes issues – zerkms Nov 21 '14 at 01:39