0

why to use post in restful web services in leman languages,luk i can use @GET and send a get request then also it will fetch or modify the data,using @GET or @post is just a convention or it leads to some technical difficulty.

Rahul ray
  • 191
  • 1
  • 4
  • 12

2 Answers2

1

In addition to what ivant said, there is also the issue of maximum request header size accepted by the server.

For GET requests it's usually about 8KB, whereas it's about 2GB for POST requests.

See this question for more details about size limits.

Community
  • 1
  • 1
Valentin Lorentz
  • 9,556
  • 6
  • 47
  • 69
0

It's more like part of the definition of REST. That is, it won't be REST if you modify the data using GET.

There is a more technical side to this as well: REST is designed to work well with existing infrastructure, like proxies. Normally GET request can be cached by proxies, while POST, PUT or DELETE cannot, because they change stuff. If you change stuff in GET, you'll have to specifically add headers to instruct any proxies against caching this request or risk getting quite strange and unexpected results.

ivant
  • 3,909
  • 1
  • 25
  • 39