diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Document/ByKeyDocumentController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Document/ByKeyDocumentController.cs index a9a60196a0..1644eac84b 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Document/ByKeyDocumentController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Document/ByKeyDocumentController.cs @@ -22,8 +22,9 @@ public class ByKeyDocumentController : DocumentControllerBase [MapToApiVersion("1.0")] [ProducesResponseType(typeof(DocumentViewModel), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> ByKey(Guid key) + public async Task ByKey(Guid key) { + // FIXME: create and use an async get method here. IContent? content = _contentService.GetById(key); if (content == null) { diff --git a/src/Umbraco.Cms.Api.Management/Controllers/DocumentType/ByKeyDocumentTypeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/DocumentType/ByKeyDocumentTypeController.cs index 54492f875f..8fc1d43293 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/DocumentType/ByKeyDocumentTypeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/DocumentType/ByKeyDocumentTypeController.cs @@ -22,8 +22,9 @@ public class ByKeyDocumentTypeController : DocumentTypeControllerBase [MapToApiVersion("1.0")] [ProducesResponseType(typeof(DocumentTypeViewModel), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task> ByKey(Guid key) + public async Task ByKey(Guid key) { + // FIXME: create and use an async get method here. IContentType? contentType = _contentTypeService.Get(key); if (contentType == null) { diff --git a/src/Umbraco.Cms.Api.Management/Factories/ContentUrlFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/ContentUrlFactory.cs index 620caa02e6..9327038b76 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/ContentUrlFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/ContentUrlFactory.cs @@ -45,11 +45,7 @@ public class ContentUrlFactory : IContentUrlFactory public async Task> GetUrlsAsync(IContent content) { - if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? umbracoContext) == false) - { - _loggerFactory.CreateLogger().LogWarning($"Unable to create an Umbraco context while attempting to get URLs for content: {content.Key}"); - return Array.Empty(); - } + IUmbracoContext umbracoContext = _umbracoContextAccessor.GetRequiredUmbracoContext(); UrlInfo[] urlInfos = (await content.GetContentUrlsAsync( _publishedRouter, diff --git a/src/Umbraco.Cms.Api.Management/Mapping/ContentType/ContentTypeMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/ContentType/ContentTypeMapDefinition.cs index 0591bf3676..97dd0a8666 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/ContentType/ContentTypeMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/ContentType/ContentTypeMapDefinition.cs @@ -1,6 +1,7 @@ using Umbraco.Cms.Api.Management.ViewModels.ContentType; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Models; +using Umbraco.Extensions; namespace Umbraco.Cms.Api.Management.Mapping.ContentType; @@ -29,6 +30,8 @@ public abstract class ContentTypeMapDefinition