How to handle complex filters in Rest API requests?

Asked

Viewed 42 times

2

In Rest Apis good practices recommend:

  • GET - List data;
  • POST - Think;
  • PUT - Update data;
  • DELETE - Erase data.

Following good practices, to recover a list of data we should use GET and for filters we should use query string.

Doubt

In the case of complex filters, 25 fields or more and/or a filter containing an array of ids, that can generate a URL with more than 2048 characters (this is bad practice).

What would be the "best" approach to be used?

  • Send the filter on Header in the JSON standard?
  • Use the method POST instead of the method GET?
  • Another solution?
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.