REST / ROA architecture. Submit database search / query / filter / collation by URL? (>, <, IN, etc.)

I am creating a REST interface for my application using ROA (Resource Oriented Architecture).

I would like to give the customer the opportunity to specify the search parameters in the url. Therefore, the client could say, “Give me all the people who:

  • "first_name" is equal to "BOB"
  • "age" is greater than "30"
  • sort by "last_name"

I thought something like:

GET /PEOPLE/{query_parameters}/{sort_parameters}

... or perhaps

GET /PEOPLE?query=<query_string>&sort=<sort_string>

... but I'm not sure which syntax would be good for specifying COLUMN_NAME-OPERATOR-VALUE in triples. I thought maybe something like:

column_name.operator.value

Thus, the client can say:

GET /PEOPLE?query=first_name.EQUALS.bob&query=age.GREATER_THAN.30&sort=last_name.ASCENDING

, - , ? Restlets, , .

+3
4

- :

GET/PEOPLE?first_name=bob&min_age=30&sort=last_name.asc.age.desc

SQL-:)

+1

i . - + ( , ). sql-. , , , :)

min/max stuff . /people?age=10,20

',', . , , minAge maxAge.

, : /people?age=10,*

: /people?sortField=name&sortOrder=ascending

+2

, ? . , objectType searchQuery, , People.

/search/{searchQuery}

, 30 50 .

/search?objectType=People&ageField1=30&ageField2=50&inclusive=true

.

+1

I updated more detailed information and clarified this at http://nsinfra.blogspot.in/2011/12/simplifying-restful-search.html . I feel that you may find this helpful.

+1
source

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


All Articles