Here is the code snippet I have tried to create a REST end point with query parameters,
<cfcomponent rest="true" restpath="api">
<cffunction name="getUsersQuery" restpath="Users?filter={query}" access="remote" returntype="struct" httpmethod="GET" produces="application/json">
<cfargument name="query" type="any" required="yes" restargsource="query" />
<cfset var response = {} />
<cfset response["message"] = "Test" />
<cfreturn response>
</cffunction>
</cfcomponent>
But when I tried to call the end point like below it gives "Method Not Allowed"
http://localhost:8010/rest/v1/api/Users?filter=userName eq "test"
Any help would be greatly appreciated.
You don't need to provide
?filter={query}
in the rest path since you have mentionedrestargsource="query"
in the argument. Also the argument name should be the URL key value.