Recommendations for HTTP GET and POST

Bad practice is the following POST request:

/test?a=1&b=2
POST data: c=3&d=4

Note that 2 parameters are part of the URL, and 2 parameters are part of the POST content.

In another note, the following rule is recommended:

  • GET request: loading contents from the server, but does not change anything on the server.
  • POST request: sending content to a server that can modify data on the server

I ask because I see a bit of everything on the Internet.

Laurent Luce

+5
source share
4 answers

, . , , , .

GET , ( ..), - .. , POST .

Wikipedia HTTP:

GET

. , GET , , , -. , GET , , . . .

POST

, (, HTML) . . .

(, HEAD, PUT, DELETE), , API. API RESTful.

+6

.

. GET, POST ( " , ?" ..).

, (GET POST).. POSTing URL GET. , . .

+3

, GET POST.

, GET POST-. , - script, - :

UPDATE datatable SET quantity=30 WHERE order=21559

:

 /update?order=21559
 POST data: quantity=30

.

+2

There is nothing wrong. The reason for the data change should be sent to POST, which means that you will no longer change the data if the user clicked the "Update" button. In this case, only GET information will be sent.

+1
source

All Articles