Skip to content Skip to sidebar Skip to footer

What Is More Efficient In Terms Of Data Consumption. Get Or Post?

Assuming we want to send the some data from a device (IOT) to our server. Small no. of variables (say 10 to 20) but updated per second. So sent to the server a large no. of times.

Solution 1:

UPDATE :

You should check this thread : Why GET method is faster than POST?

In fact POST use a little bit more data because the header contain some more info like the type of content and it's length

POST /blog/ HTTP/1.1
Host: host.comContent-Length: 27Content-Type: application/x-www-form-urlencoded

name1=value1&name2=value2

OLD :

GET requests:

GET /blog/?name1=value1&name2=value2 HTTP/1.1Host: host.com

POST requests:

POST /blog/ HTTP/1.1
Host: host.com
name1=value1&name2=value2

As you can see there is no big difference in term of length so both request should use the same ammount of data. GET have some limitaion for the url length (2048) and it can only contain ASCII

Source : http://blog.teamtreehouse.com/the-definitive-guide-to-get-vs-post

Solution 2:

Well technically and according to multiple answers in this question : When do you use POST and when do you use GET?

GET is generally used to retrieve data from a server and POST to submit data to a server. So in your use case you might want to use POST instead of GET.

But generally POST is slower and would be bigger in size than a GET request. That is if the data send in both requests is identical.

Post a Comment for "What Is More Efficient In Terms Of Data Consumption. Get Or Post?"