We are trying to implement a complex search functionality in Rest service using coldfusion 10.
Something like projectid=1 and active=1 and (ManagerName contains John or ManagerName contains alfred)
One way of doing this is ?projectid=1&active=1&ManagerName=[John,Alfred]. However this does not serve my purpose as the ManagerName search will not return the required result. Also, as the number of search filter grows, the query string becomes tough to handle.
I tried to get an xml (with all search filter) as an input through HTTP Get Request, but that did not help, as GetHTTPRequestData() does not reflect the xml content.
Is there any means to pass an xml/json through an HTTP Get Request??
Will it be a bad practice, if xml is passed by a HTTP Post Request??
Are there any other options to pass complex filter param to a REST service??
i have gone through a lot of post on the site for similar question, but still could not find a solution to my problem.
GETshould be idempotent it should not modify the state of the Resource. strictly limitgetusage toReadoperationsyour
POSTtriggers Resource Creation i.e along with payload (xml/json).It is very bad practice to use POST for search.Also you should take-care of the Cache-Control as your
GETrequests might get cached and if your search is real time you might get stale data.You can take example as
stackoverflowitselfIn above URl, path elements
questions,tagged,restderive subset ofquestionresources.The query parameters suggest filtering of those which met the creiteria.