[SOLVED] ServiceStack v6 – Route starting with /api produces NotImplementedExceptio

Issue

Greetings.

I started a new project with ServiceStack v6. I noticed that when I use routes starting with /api, they will produce a NotImplementedException when called. I believe this is due to the new API Explorer UI implemented on ServiceStack v6. I am not entirely sure about this but I have a hunch this might be the culprit.

Is there any way to disable API Explorer UI? I want my /api routes to work as they used to work on ServiceStack 5.13.2
Or perhaps changing the /api prefix handler to something else would also be fine by me, API Explorer UI seems like a feature I would like to use.

Notes:

Removing /api from my route will make it work just fine. An interesting observation is that it will also work if I add another slash before /api and essentially call http://localhost//api/chat/join

Working example:

appHost.Routes.Add<JoinChatRequest>("/chat/join", ApplyTo.Get);

Example producing a NotImplementedException when called:

appHost.Routes.Add<JoinChatRequest>("/api/chat/join", ApplyTo.Get);

Solution

This is due to the JSON /api pre-defined route that was added in v6.0 which can be explicitly can be disabled with:

ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);

Answered By – mythz

Answer Checked By – Dawn Plyler (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *