Umbraco 15 Backoffice API

I’m going my first steps with Umbraco 15. What I want to achieve is getting and calling a backoffice api controller like it was possible with UmbracoAuthorizedApiController in the past.

I learned, that the APIs now have the route /umbraco/management/api/v1/ plus some additional route segments. I can’t manage to get a simple controller done. Consider the following code:

[VersionedApiBackOfficeRoute("laykit/environment")]
[ApiVersion("1.0")]
public class EnvironmentController : ManagementApiControllerBase
{
    [HttpGet]
    public string Get()
    {
        return "Teststring";
    }
}

What is the right route to call this API from my backoffice extension? Is the above definition false? This would be the client code:

fetch("/umbraco/management/api/v1/laykit/environment")
	.then(data=>this.data = data);

I tried with and without the get segment, it doesn’t work. What I also want to achieve is, that the backoffice login should be sufficient to be authorized to all this api.

Do you have any insights to share, which makes this working?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/115231-umbraco-15-backoffice-api