Copied to clipboard

Flag this post as spam?

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


  • Debbinson 2 posts 22 karma points
    Jun 18, 2024 @ 10:01
    Debbinson
    0

    Umbraco 13.3.2 : Umbraco Api Controller error 500 while using custom routes

    Hello everyone, I am encountering an issue while using custom routes with UmbracoApiController. This is an example of my code:

    [Route("api/version")]
    public class ExampleController: UmbracoApiController
    {
    
        [HttpGet]
        public object GetExampleVersionInfo() => Content($"ModelVersion: {GetModelVersion()});
    }
    

    I currently solved this by using SurfaceControllers but it is not ideal in my opinion. I wanted to ask you if this is an issue related to UmbracoApiControllers or I am missing something. Thank you in advance

  • Simon Napper 116 posts 370 karma points
    Jun 18, 2024 @ 11:32
    Simon Napper
    0

    I'm not sure what GetModelVersion does, but you are missing a double quote at the end of GetExampleVersionInfo.

    Should be more like this perhaps?

    public object GetExampleVersionInfo() => Content($"ModelVersion: {GetModelVersion()}");
    
Please Sign in or register to post replies

Write your reply to:

Draft