Is there a canonical/RESTful way to send query details to a server during a GET?

后端 未结 8 1166
余生分开走
余生分开走 2021-01-18 19:23

I\'m designing a (more or less) RESTful internal web service running on ASP.NET and IIS. I want clients to be able to pass query details to the server when accessing large

8条回答
  •  一个人的身影
    2021-01-18 19:50

    The best way would be to serialize the search JSON object and pass it as a query parameter. Are you sure it will be too long for modern browsers and servers? Modern browsers and servers can handle pretty hefty GET query parameter lengths, thousands of characters.

    Perhaps an extension header like X-Custom-Query-Parameters-JSON if objects are going to be more on the order of 8k characters.

    How many characters would a serialized JSON object be in your particular case?

    Some related questions about character limits:

    What is the limit on QueryString / GET / URL parameters

    Is there a practical HTTP Header length limit?

提交回复
热议问题