java - REST API filtering with related resources best practices -


what best practice include related resources in search query?

my resources are:

/projects /participants /questions /questionanswers 

the query like: participants are:

- between age of 20 , 40 and, - male and, - selected answer x of question y  

would

/participants?search=gender:male,age>=20,age<=40,question:x,answer:y

is there better or standard way type of queries?

you can use object serialization & filters. like:

/participants?filter={gender={male}, age={between={20, 40}}, question={x}, answer={y}}

for given example with:

  • gender = male, female
  • age = (1...99) or between={start, end} or till={end} or from={start} etc..

in case, have possibility filter more specific and/or combined. combination example:

/participants?filter={gender={male, female}, age={21,22, 23, from={40}}, question={x}, answer={y}}

result: gender male , female age 21, 22, 23 , 40 till 99 (or want)


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -