Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Chris Perks 32 posts 114 karma points
    Mar 24, 2014 @ 23:02
    Chris Perks

    Default Get method for UmbracoApiController

    In vanilla Web Api, I can have something like:

        // GET api/products
        public IEnumerable<Product> Get()
            return Products.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. 

    Are default Get methods supported in Umbraco?



  • Jeroen Breuer 4861 posts 12132 karma points MVP 3x admin c-trib
    Mar 25, 2014 @ 06:53
    Jeroen Breuer


    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:


  • Chris Perks 32 posts 114 karma points
    Mar 27, 2014 @ 12:55
    Chris Perks

    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.

  • Dave Woestenborghs 3232 posts 10955 karma points MVP 5x admin c-trib
    Mar 27, 2014 @ 15:11
    Dave Woestenborghs

    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


Please Sign in or register to post replies

Write your reply to: