I have a requirement to get input from a web app UI, send this input to the server who will run an algorithm on it. The web server will send back the output of the algorithm the the UI. Is an HTTP POST method appropriate for this type of interaction since I'm not technically creating any data?

  • 2
    Yes, a POST method is appropriate. Dec 17, 2019 at 23:39
  • 1
    Especially if you are not abiding by REST conventions. A POST will work just fine, and would provide a minimal guard against Cross-Site Scripting attacks. Don't over think this. Dec 18, 2019 at 0:09

3 Answers 3


Let's look at this from the perspective of the Algorithm Service - It is being asked to supply a result (output of the algorithm).

As long as the answer is idempotent - meaning that for the same inputs, we get the same output and that there are no intended side effects that are expected, and the input parameters are few and simple values, then I would choose GET, in part because it is more RESTful, which makes any operations level monitoring easier in production, but also testing is more accessible - anyone can use it directly with a web browser.

If the function is not idempotent, or if the input parameters for the algorithm is complex, then POST becomes a better choice.

Finally, how important is this decision? Which factors matter the most in the decision? Usability by the users? observability of live behaviours? Simplicity in writing the code? Hackability of the interface for use by other applications?


It depends on the input - if the input is short (e.g. less than around 50 - 100 characters) and not expected to contain anything too secret or sensitive, and the algorithm is deterministic, and the algorithm has no side effects that the user needs to care about, then a GET request would be appropriate, with the input used as part of the URI.

This has some advantages over POST. It can be executed (and tested) simply by following a link, or by typing an address into a browser address bar, and is easier to cache.


Use a POST method your task is straightforward no complication it is just an interaction between your interface and a server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.