Copied to clipboard

Flag this post as spam?

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

  • Vinod 22 posts 83 karma points
    Jun 18, 2015 @ 07:29

    Umbraco and SwaggerUI/SwashBuckle


    I am trying to use SwashBuckle in my Umbraco MVC Project. MVC Version - 4.0 and Umbraco Version - 7.2.6. I am facing some issues like

    1) The response in /swagger/ui/index.html is taking too much time to load and its listing all apis in umbraco such as "Media", "Content Tree" etc.. instead of listing my api controller actions alone. Have any one experienced this issue?

    2) "Not supported by Swagger 2.0: Multiple operations with path 'api/ContentTree/CreateTreeNode/{id}' and method 'POST'. See the config setting - "ResolveConflictingActions" for a potential workaround. This is the message I am getting.

    Can some one provide a solution for the same. Is there any version dependencies with Umbraco.

    Thanks, Vinod

  • Vinod 22 posts 83 karma points
    Jun 18, 2015 @ 12:48


    Found the solution for the same.

    Step 1: Create WebAPI project and install Umbraco.

    Step 2: Follow the procedure mentioned in and create the classes( create IncludeInApiExplorer, IncludeInApiExplorerAttribute, ApiController)

    Step 3: Install SwashBuckle

    Step 4: And add the "httpConfiguration.Services.Replace(typeof(IApiExplorer), new OptInApiExplorer(config));" in the Swagger.config file

    Step 5: Navigate to localhost:port/swagger/ui/index

    Thanks Vinod

  • lucuma 249 posts 529 karma points
    Oct 29, 2015 @ 17:09

    Thank you this helped me a lot. Out of curiosity do you know how to remove the option {id} that is appearing in all the methods for my api controller?


    POST /umbraco/Api/Stuff/MyRequests/{id}

    Everyone of the actions has that id in the swagger docs which I assume is defined in some default route. The action MyRequests doesn't accept any parameters so I'd like to see about removing it.

  • lucuma 249 posts 529 karma points
    Oct 30, 2015 @ 15:08

    I ended up just decorating each method with the route attribute to remove it.

     public ActionResult MyRequests()
  • Tiago 2 posts 22 karma points
    Apr 17, 2017 @ 15:45


    In my case, that didn't solve this issue. The {id} still appears at the end of each method in my UmbracoApiController. For you, the solution was only set the [Route("")] attribute with the same name as the method?

    Can you help me? Thanks in advance

  • Chris Randle 65 posts 176 karma points c-trib
    Apr 17, 2017 @ 17:29
    Chris Randle

    If you're just trying to get rid of the ID parameter, well couldn't you just ignore it? It's not exactly mandatory. It's easier to ignore than to remove I think.

  • Chris Randle 65 posts 176 karma points c-trib
    Feb 21, 2017 @ 16:28
    Chris Randle

    So in Umbraco 7.5.3, I installed Swashbuckle. There is no Swagger.config file but there is a SwaggerConfig.cs but the signature is different.

    I implemented the OptInApiExplorer code as per the example, and because there is no Register signature that is taking HttpConfiguration, I tried the following but it doesn't work.

                HttpConfiguration config = new HttpConfiguration();
            config.Services.Replace(typeof(IApiExplorer), new OptInApiExplorer(config));

    I tried this in the SwaggerConfig.cs before and after the initialisation code bit:

    var thisAssembly = typeof(SwaggerConfig).Assembly;
                .EnableSwagger(c => ...).EnableSwaggerUI(c => ...);

    but nothing works. Any ideas?

  • Chris Randle 65 posts 176 karma points c-trib
    Feb 21, 2017 @ 16:30
    Chris Randle

    Fixed it by entering

    GlobalConfiguration.Configuration.Services.Replace(typeof(IApiExplorer), new OptInApiExplorer(GlobalConfiguration.Configuration));

    after the initialisation block.

  • Biagio Paruolo 1492 posts 1633 karma points c-trib
    Mar 16, 2018 @ 08:21
    Biagio Paruolo

    How to remove the {id} wrong parameter?

    Here is another info:

  • vijaya shivgand 23 posts 122 karma points
    Apr 26, 2018 @ 20:15
    vijaya shivgand

    I wrote following and it worked for me

    httpConfiguration .EnableSwagger((c) => { c.SingleApiVersion("v1", "A title for your API")); c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); });

  • Jakob Kristensen 36 posts 169 karma points
    May 31, 2018 @ 07:31
    Jakob Kristensen

    Anyone found a solution to this, its confusing the hell out of our frontenders with the extra ID but overall it helps a ton having this functionality :) Plus its making errors when we try to autogenerate a client from this, is there anyway to overwrite the route config from umbraco and just use ones own? :)

  • Gleb Anisimov 1 post 71 karma points
    Jun 25, 2018 @ 09:45
    Gleb Anisimov

    In case somebody is still wandering "how to remove Id".
    1) Add Route ( namespace : System.Web.Http, NOT System.Web.Mvc )

    public bool ProductSave([FromBody]ProductEditModel saveModel)

    2) Check that you have MapHttpAttributeRoutes() in App_Start


    Works in my case.

Please Sign in or register to post replies

Write your reply to: