Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Search action should be an HTTP GET or a POST?

Search action should be an HTTP GET or a POST?

Scheduled Pinned Locked Moved Web Development
discussioncsssysadminquestionlearning
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlexCode
    wrote on last edited by
    #1

    What do you think? Ok, basically doesn't matter, it works anyway but I like to have my HTTP verbs used the right way. Since ever I've been using GET to handle all the data pulling actions. So everytime I need to pull data from the server I use a GET, everytime I push data to the server I use a POST. Yesterday I had this discussion with a guy that argued that search operations (like an AJAX request that implements a grid filtering mechanism) must be a POST because it doesn't return a resource... (I really couldn't understand this answer... I tried to but it was impossible to make him explain to me what it meant by that in other words) Search operations, for me, naturally fit in the data pulling logic. Although it may be filtered data, and we may need to pass a bunch of filter options to the server, the operation itself is to retrieve data from the server. What do you think?

    L Z 2 Replies Last reply
    0
    • A AlexCode

      What do you think? Ok, basically doesn't matter, it works anyway but I like to have my HTTP verbs used the right way. Since ever I've been using GET to handle all the data pulling actions. So everytime I need to pull data from the server I use a GET, everytime I push data to the server I use a POST. Yesterday I had this discussion with a guy that argued that search operations (like an AJAX request that implements a grid filtering mechanism) must be a POST because it doesn't return a resource... (I really couldn't understand this answer... I tried to but it was impossible to make him explain to me what it meant by that in other words) Search operations, for me, naturally fit in the data pulling logic. Although it may be filtered data, and we may need to pass a bunch of filter options to the server, the operation itself is to retrieve data from the server. What do you think?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      AlexCode wrote:

      What do you think?

      I think it depends on the circumstance and environment. I love to be able to bookmark a parameterized url, always more efficient than having to navigate to the page from the homepage. OTOH, I can imagine some people wanting to keep their search-terms private. Check out the history of your browser, and you'll see what I mean.

      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

      A 1 Reply Last reply
      0
      • L Lost User

        AlexCode wrote:

        What do you think?

        I think it depends on the circumstance and environment. I love to be able to bookmark a parameterized url, always more efficient than having to navigate to the page from the homepage. OTOH, I can imagine some people wanting to keep their search-terms private. Check out the history of your browser, and you'll see what I mean.

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        A Offline
        A Offline
        AlexCode
        wrote on last edited by
        #3

        On your answer you actually give me one more reason why a search should be a GET (for bookmarking). Although this is not the case, is for internal ajax requests handling, but the same concept still applies. The only circonstance I can imagine using a POST instead of a GET on this is it the data to be passed to the server is such that there's a chance of overloading the URL max size standards. Otherwise, its a GET!!! :) Thanks!

        L 1 Reply Last reply
        0
        • A AlexCode

          On your answer you actually give me one more reason why a search should be a GET (for bookmarking). Although this is not the case, is for internal ajax requests handling, but the same concept still applies. The only circonstance I can imagine using a POST instead of a GET on this is it the data to be passed to the server is such that there's a chance of overloading the URL max size standards. Otherwise, its a GET!!! :) Thanks!

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You're welcome :)

          1 Reply Last reply
          0
          • A AlexCode

            What do you think? Ok, basically doesn't matter, it works anyway but I like to have my HTTP verbs used the right way. Since ever I've been using GET to handle all the data pulling actions. So everytime I need to pull data from the server I use a GET, everytime I push data to the server I use a POST. Yesterday I had this discussion with a guy that argued that search operations (like an AJAX request that implements a grid filtering mechanism) must be a POST because it doesn't return a resource... (I really couldn't understand this answer... I tried to but it was impossible to make him explain to me what it meant by that in other words) Search operations, for me, naturally fit in the data pulling logic. Although it may be filtered data, and we may need to pass a bunch of filter options to the server, the operation itself is to retrieve data from the server. What do you think?

            Z Offline
            Z Offline
            Zamshed Farhan
            wrote on last edited by
            #5

            Yes, I think so.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups