Tutorial :What is the way to do an idempotent HTTP request with data that does not fit in the URL?



Question:

So, basically the 255-char limitation of URLs is too short for me, and I don't want to rely on ignoring it.

My request will not change anything on the HTTP server end. I need to send some data with request, that is slightly larger than 1024 characters in size and is NOT of secure/secret character. The server will use the data for verification against a database and return a result of this verification, but nothing is changed. The request is thus said to be idempotent. In pseudecode, client calls RPC:

int verify_data(char[>1024] data)  

Can I use POST or will this violate principles of REST and other good HTTP client/server design? I obviously cannot use GET?


Solution:1

What is the maximum length of a URL in different browsers?

Do you control the server and the client? If you know that both will handle the length, then I would go ahead and run with it.


Solution:2

I have a similar trouble

May be using PUT is a better alternative. I mean, according to REST principles PUT should also be an idempotent operation (so that servers might cache it) and you don't have the limitation size of GET


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »