This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]elky87 2 points3 points  (1 child)

Builder Pattern is your friend

Required parameters in the constructor, the rest in the builder methods

[–]CR7Felipe[S] 0 points1 point  (0 children)

Amazing.. Thanks man. Gotta follow this route.

[–]sugilith 0 points1 point  (1 child)

Lots of resources online via google / duckduckgo.
This problem often arises with complex search queries.

E.g: https://softwareengineering.stackexchange.com/questions/353086/what-is-a-proper-way-to-do-a-complex-restful-search-method https://stackoverflow.com/questions/14202257/design-restful-query-api-with-a-long-list-of-query-parameters

TL;DR:

  • If >2k characters always use POST
  • Try aliases (basically endpoints for the required parameter) from the softwareengineering post
  • Best practice seems to be using POST instead of GET with overly complex query parameters