0

URL parameter or post form data; which is more computationally efficient for a backend API to query?

example:

GET : user/:id

POST: user/ { "id": "some_id" }
えるまる
  • 1,901
  • 3
  • 17
  • 36
  • Possible duplicate of [What is the difference between POST and GET?](https://stackoverflow.com/questions/3477333/what-is-the-difference-between-post-and-get) – えるまる Aug 31 '19 at 11:55
  • I am not really convinced that this has any significant impact performance-wise. Usually compared to database queries, middleware, etc. the number of cycles to decode the data is insignificant. – Willem Van Onsem Aug 31 '19 at 11:59
  • I think it's not a duplicate of that because I know the difference between `GET` & `POST`. A same task can be solved by both GET` and `POST`. My question is which is computationally more efficient avoiding all other things. @Erumaru – A T M Ragib Raihan Aug 31 '19 at 12:04
  • @ATMRagibRaihan https://stackoverflow.com/questions/1211881/why-is-the-get-method-faster-than-post-in-http – えるまる Aug 31 '19 at 12:09
  • https://stackoverflow.com/questions/44409014/what-is-more-efficient-in-terms-of-data-consumption-get-or-post?noredirect=1&lq=1 – えるまる Aug 31 '19 at 12:09
  • Yes, the difference will be very insignificant practically. But I am just curious to know which is more efficient theoretically. @WillemVanOnsem – A T M Ragib Raihan Aug 31 '19 at 12:10
  • Well just don't use POST when you're meant to use GET. It's a standard. What you should be comparing is `GET : user/:id` and `GET: user/?id=some_id` instead, if you do just want to filter with the id. Filtering with form data is just outrightly wrong – Ken4scholars Sep 01 '19 at 21:11

0 Answers0