Custom Backoffice API
Example of a Custom Backoffice API with Authorization and OpenAPI.
<PropertyGroup>
<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>
</PropertyGroup>using Umbraco.Cms.Api.Common.OpenApi;
using Umbraco.Cms.Api.Management.OpenApi;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
namespace Umbraco.Cms.Web.UI.Custom;
public class MyApiComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
=> builder.AddBackOfficeOpenApiDocument(
"my-api-v1",
document => document
.WithTitle("My API v1")
.WithBackOfficeAuthentication()
.WithJsonOptions(Constants.JsonOptionsNames.BackOffice));
}

Last updated
Was this helpful?