stops working "could not get context" if I slap e.g.,
[Route("MyRoute")]
on an action method in an
UmbracoApiController
.
Is it because the route is no longer
/umbraco/api/something
and the context cannot be determined? Is there a workaround?
s
Sebastiaan
04/19/2024, 7:25 AM
Probably because the route is no longer that yeah, can't remember exactly.
You should be able to make a service that constructs an umbraco context so you can call it from your api controller. The second code block here gets an
Have you tried looking at the Swagger page to see what routes are enabled?
k
kdx-perbol
04/22/2024, 7:48 AM
There's only the Delivery API there. The "Default API" has no operations. Not sure what you mean by "routes are enabled"? This is a custom API controller (
UmbracoApiController
) that can use the Umbraco helper accessor fine when running on the default route but not on the custom route. I haven't decorated the controller in a way that the built-in Swagger would pick up. (But maybe I should.)