REST - complex applications

后端 未结 5 1432
南方客
南方客 2020-12-02 04:06

I\'m struggling to apply RESTful principles to a new web application I\'m working on. In particular, it\'s the idea that to be RESTful, each HTTP request should carry enoug

5条回答
  •  我在风中等你
    2020-12-02 04:46

    Are you working on a RESTful API that other apps will use to search your data? Or are you building a end-user focused web application where users will log in and perform these searches?

    If your users are logging in, then you're already stateful as you'll have some type of session cookie to maintain the logged in state. I would go ahead and create a session object that contains all the search filters. If a user hasn't set any filters, then this object will be empty.

    Here's a great blog post about using GET vs POST. It mentions a URL length limit set by Internet Explorer of 2,048 characters, so you want to use POST for long requests.

    http://carsonified.com/blog/dev/the-definitive-guide-to-get-vs-post/

提交回复
热议问题