Table of Contents

Class MediaTypeController

Namespace
Umbraco.Cms.Web.BackOffice.Controllers
Assembly
Umbraco.Web.BackOffice.dll

An API controller used for dealing with content types

public class MediaTypeController : ContentTypeControllerBase<IMediaType>
Inheritance
MediaTypeController
Inherited Members

Constructors

MediaTypeController(ICultureDictionary, EditorValidatorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IShortStringHelper, IEntityService, IMediaService, IBackOfficeSecurityAccessor)

public MediaTypeController(ICultureDictionary cultureDictionary, EditorValidatorCollection editorValidatorCollection, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IUmbracoMapper umbracoMapper, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, IEntityService entityService, IMediaService mediaService, IBackOfficeSecurityAccessor backofficeSecurityAccessor)

Parameters

cultureDictionary ICultureDictionary
editorValidatorCollection EditorValidatorCollection
contentTypeService IContentTypeService
mediaTypeService IMediaTypeService
memberTypeService IMemberTypeService
umbracoMapper IUmbracoMapper
localizedTextService ILocalizedTextService
shortStringHelper IShortStringHelper
entityService IEntityService
mediaService IMediaService
backofficeSecurityAccessor IBackOfficeSecurityAccessor

Methods

DeleteById(int)

Deletes a media type with a given ID

[HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult DeleteById(int id)

Parameters

id int

Returns

IActionResult

DeleteContainer(int)

Deletes a media type container with a given ID

[HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult DeleteContainer(int id)

Parameters

id int

Returns

IActionResult

GetAll()

Returns all media types

[Authorize(Policy = "TreeAccessMediaTypes")]
public IEnumerable<ContentTypeBasic> GetAll()

Returns

IEnumerable<ContentTypeBasic>

GetAllFiltered(string[])

Returns a media type by alias

public IEnumerable<MediaTypeDisplay> GetAllFiltered(string[] aliases)

Parameters

aliases string[]

Alias of the media type

Returns

IEnumerable<MediaTypeDisplay>

GetAllowedChildren(Guid)

Returns the allowed child content type objects for the content item id passed in - based on a GUID id

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public ActionResult<IEnumerable<ContentTypeBasic>> GetAllowedChildren(Guid contentId)

Parameters

contentId Guid

Returns

ActionResult<IEnumerable<ContentTypeBasic>>

GetAllowedChildren(int)

Returns the allowed child content type objects for the content item id passed in - based on an INT id

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public IEnumerable<ContentTypeBasic> GetAllowedChildren(int contentId)

Parameters

contentId int

Returns

IEnumerable<ContentTypeBasic>

GetAllowedChildren(Udi)

Returns the allowed child content type objects for the content item id passed in - based on a UDI id

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public ActionResult<IEnumerable<ContentTypeBasic>> GetAllowedChildren(Udi contentId)

Parameters

contentId Udi

Returns

ActionResult<IEnumerable<ContentTypeBasic>>

GetAvailableCompositeMediaTypes(GetAvailableCompositionsFilter)

Returns the available compositions for this content type This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body

[HttpPost]
[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult GetAvailableCompositeMediaTypes(GetAvailableCompositionsFilter filter)

Parameters

filter GetAvailableCompositionsFilter

Filter applied when resolving compositions

Returns

IActionResult

GetById(Guid)

Gets the media type a given guid

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public ActionResult<MediaTypeDisplay?> GetById(Guid id)

Parameters

id Guid

Returns

ActionResult<MediaTypeDisplay>

GetById(int)

Gets the media type a given id

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public ActionResult<MediaTypeDisplay?> GetById(int id)

Parameters

id int

Returns

ActionResult<MediaTypeDisplay>

GetById(Udi)

Gets the media type a given udi

[Authorize(Policy = "TreeAccessMediaOrMediaTypes")]
public ActionResult<MediaTypeDisplay?> GetById(Udi id)

Parameters

id Udi

Returns

ActionResult<MediaTypeDisplay>

GetCount()

public int GetCount()

Returns

int

GetEmpty(int)

[Authorize(Policy = "TreeAccessMediaTypes")]
public MediaTypeDisplay? GetEmpty(int parentId)

Parameters

parentId int

Returns

MediaTypeDisplay

GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter)

Returns where a particular composition has been used This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body

[HttpPost]
[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter filter)

Parameters

filter GetAvailableCompositionsFilter

Returns

IActionResult

PostCopy(MoveOrCopy)

Copy the media type

[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult PostCopy(MoveOrCopy copy)

Parameters

copy MoveOrCopy

Returns

IActionResult

PostCreateContainer(int, string)

[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult PostCreateContainer(int parentId, string name)

Parameters

parentId int
name string

Returns

IActionResult

PostMove(MoveOrCopy)

Move the media type

[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult PostMove(MoveOrCopy move)

Parameters

move MoveOrCopy

Returns

IActionResult

PostRenameContainer(int, string)

[Authorize(Policy = "TreeAccessMediaTypes")]
public IActionResult PostRenameContainer(int id, string name)

Parameters

id int
name string

Returns

IActionResult

PostSave(MediaTypeSave)

[Authorize(Policy = "TreeAccessMediaTypes")]
public ActionResult<MediaTypeDisplay?> PostSave(MediaTypeSave contentTypeSave)

Parameters

contentTypeSave MediaTypeSave

Returns

ActionResult<MediaTypeDisplay>