diff --git a/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs b/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs index 79a0ceeecd4f..baa13f52478d 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs @@ -44,6 +44,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers; [PluginController(Constants.Web.Mvc.BackOfficeApiArea)] [Authorize(Policy = AuthorizationPolicies.TreeAccessDocuments)] [ParameterSwapControllerActionSelector(nameof(GetById), "id", typeof(int), typeof(Guid), typeof(Udi))] +[ParameterSwapControllerActionSelector(nameof(GetByIds), "ids", typeof(int[]), typeof(Guid[]), typeof(Udi[]))] [ParameterSwapControllerActionSelector(nameof(GetNiceUrl), "id", typeof(int), typeof(Guid), typeof(Udi))] public class ContentController : ContentControllerBase { @@ -247,6 +248,30 @@ public IEnumerable GetByIds([FromQuery] int[] ids) return foundContent.Select(MapToDisplay).WhereNotNull(); } + /// + /// Return content for the specified ids + /// + /// + /// + [FilterAllowedOutgoingContent(typeof(IEnumerable))] + public IEnumerable GetByIds([FromQuery] Guid[] ids) + { + IEnumerable foundContent = _contentService.GetByIds(ids); + return foundContent.Select(MapToDisplay).WhereNotNull(); + } + + /// + /// Return content for the specified ids + /// + /// + /// + [FilterAllowedOutgoingContent(typeof(IEnumerable))] + public IEnumerable GetByIds([FromQuery] Udi[] ids) + { + IEnumerable foundContent = _contentService.GetByIds(ids)!; + return foundContent.Select(MapToDisplay).WhereNotNull(); + } + /// /// Updates the permissions for a content item for a particular user group /// diff --git a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs index 404713a2b969..f3608d38f961 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/MediaController.cs @@ -47,6 +47,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers; [PluginController(Constants.Web.Mvc.BackOfficeApiArea)] [Authorize(Policy = AuthorizationPolicies.SectionAccessMedia)] [ParameterSwapControllerActionSelector(nameof(GetById), "id", typeof(int), typeof(Guid), typeof(Udi))] +[ParameterSwapControllerActionSelector(nameof(GetByIds), "ids", typeof(int[]), typeof(Guid[]), typeof(Udi[]))] [ParameterSwapControllerActionSelector(nameof(GetChildren), "id", typeof(int), typeof(Guid), typeof(Udi))] public class MediaController : ContentControllerBase { @@ -296,6 +297,30 @@ public MediaItemDisplay GetRecycleBin() return foundMedia.Select(media => _umbracoMapper.Map(media)); } + /// + /// Return media for the specified ids + /// + /// + /// + [FilterAllowedOutgoingMedia(typeof(IEnumerable))] + public IEnumerable GetByIds([FromQuery] Guid[] ids) + { + IEnumerable foundMedia = _mediaService.GetByIds(ids); + return foundMedia.Select(media => _umbracoMapper.Map(media)); + } + + /// + /// Return media for the specified ids + /// + /// + /// + [FilterAllowedOutgoingMedia(typeof(IEnumerable))] + public IEnumerable GetByIds([FromQuery] Udi[] ids) + { + IEnumerable foundMedia = _mediaService.GetByIds(ids); + return foundMedia.Select(media => _umbracoMapper.Map(media)); + } + /// /// Returns a paged result of media items known to be of a "Folder" type ///