// GET api/products[HttpGet]publicIEnumerable<Product>Get(){returnProducts.GetAll();}
I am creating a controller (implementing UmbracoApiController) in v7 and would like to have a default action method for Get() requests on that controlller.
This doesn't seem to work, I have to call /api/products/get to get anything back from the controller.
Default Get method for UmbracoApiController
In vanilla Web Api, I can have something like:
I am creating a controller (implementing UmbracoApiController) in v7 and would like to have a default action method for Get() requests on that controlller.
This doesn't seem to work, I have to call /api/products/get to get anything back from the controller.
Are default Get methods supported in Umbraco?
Thanks.
Hello,
I tried myself, but it looks like that won't work and you need to go to the full url.
Here are some more examples: http://our.umbraco.org/projects/developer-tools/hybrid-framework/hybrid-framework/47815-Using-Ajax-with-the-framework?p=0#comment172879
Jeroen
Thanks for the tips, Jeroen!
I'm going to have a play with some custom routing at the weekend and see what I can come up with.
In the original post you mention that you try to acces your API with the following url : /api/products/get
This should be : /umbraco/api/products/get
Dave
is working on a reply...