Score:0

Multiple gets in a module rest resource

ph flag

I have this module named elv_products. This module contains an rest resource with the uri_paths:

 *   uri_paths = {
 *     "canonical" = "/api/products",
 *   }

For example when i make a get request it looks like:

.../api/products?house_type=apartment&property_surface=84

the get returns all products where the house_type === 'apartment' and property_surface === '84'. But i also need a get to get all the products overal. So i need 2 gets, 1 for all products and 1 for all products but with filters.

Whats the best way to fix this? or is it possible to have 2 rest resources in 1 module?

Any help is welcome!

cn flag
Why don't you just make the REST resource return all products when there is no filter in the query?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.