RESTful URLs for a search service with an arbitrary number of filtering criteria

I want to create a RESTful web service that implements a search interface for a biological database.

A typical search query may include about a dozen data attributes. For example, a search by scientific name limits the search to a depth of less than 100 m. My first instinct is to have all the attributes in the query string for example? SearchType = sciname & sciname = Mola Mola + & maxdepth = 100 & mindepth = 0

However, query strings are considered non-RESTful, see http://rest.blueoxen.net/cgi-bin/wiki.pl?QueryStringsConsideredHarmful

I reviewed some of the earlier SO discussions, such as the RESTful URL design for search, and I'm still unclear why my question is:

Is there an accepted standard or pattern for a RESTful URL for a search service where there can be an arbitrary number of filter values?

+3
source share
1 answer

REST-style on the web:

  • The uri request path component identifies a specific resource.
  • The request-uri query string component identifies any specific filters or changes made when presenting this resource.
  • The Accept header defines the specific type of content in which this resource should be presented, filtered as indicated.
  • Accept-Language , , .

, :

GET /species?searchType=sciname&sciname=mola+mola&maxdepth=100&mindepth=0

.

+10

Source: https://habr.com/ru/post/1724403/


All Articles