complexe method in Rest class to parse options and build query