Class DataTypeController
- Namespace
- Umbraco.Cms.Web.BackOffice.Controllers
- Assembly
- Umbraco.Web.BackOffice.dll
The API controller used for editing data types
[Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public class DataTypeController : BackOfficeNotificationsController
- Inheritance
-
DataTypeController
- Inherited Members
Remarks
The security for this controller is defined to allow full CRUD access to data types if the user has access to either: Content Types, Member Types or Media Types ... and of course to Data Types
Constructors
DataTypeController(PropertyEditorCollection, IDataTypeService, IOptionsSnapshot<ContentSettings>, IUmbracoMapper, PropertyEditorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, ILocalizedTextService, IBackOfficeSecurityAccessor, IConfigurationEditorJsonSerializer)
[Obsolete("Use constructor that takes IDataTypeUsageService, scheduled for removal in V12")]
public DataTypeController(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IOptionsSnapshot<ContentSettings> contentSettings, IUmbracoMapper umbracoMapper, PropertyEditorCollection propertyEditorCollection, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, ILocalizedTextService localizedTextService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, IConfigurationEditorJsonSerializer serializer)
Parameters
propertyEditorsPropertyEditorCollectiondataTypeServiceIDataTypeServicecontentSettingsIOptionsSnapshot<ContentSettings>umbracoMapperIUmbracoMapperpropertyEditorCollectionPropertyEditorCollectioncontentTypeServiceIContentTypeServicemediaTypeServiceIMediaTypeServicememberTypeServiceIMemberTypeServicelocalizedTextServiceILocalizedTextServicebackOfficeSecurityAccessorIBackOfficeSecurityAccessorserializerIConfigurationEditorJsonSerializer
DataTypeController(PropertyEditorCollection, IDataTypeService, IOptionsSnapshot<ContentSettings>, IUmbracoMapper, PropertyEditorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, ILocalizedTextService, IBackOfficeSecurityAccessor, IConfigurationEditorJsonSerializer, IDataTypeUsageService)
[ActivatorUtilitiesConstructor]
public DataTypeController(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IOptionsSnapshot<ContentSettings> contentSettings, IUmbracoMapper umbracoMapper, PropertyEditorCollection propertyEditorCollection, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, ILocalizedTextService localizedTextService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, IConfigurationEditorJsonSerializer serializer, IDataTypeUsageService dataTypeUsageService)
Parameters
propertyEditorsPropertyEditorCollectiondataTypeServiceIDataTypeServicecontentSettingsIOptionsSnapshot<ContentSettings>umbracoMapperIUmbracoMapperpropertyEditorCollectionPropertyEditorCollectioncontentTypeServiceIContentTypeServicemediaTypeServiceIMediaTypeServicememberTypeServiceIMemberTypeServicelocalizedTextServiceILocalizedTextServicebackOfficeSecurityAccessorIBackOfficeSecurityAccessorserializerIConfigurationEditorJsonSerializerdataTypeUsageServiceIDataTypeUsageService
Methods
DeleteById(int)
Deletes a data type with a given ID
[HttpDelete]
[HttpPost]
public IActionResult DeleteById(int id)
Parameters
idint
Returns
DeleteContainer(int)
Deletes a data type container with a given ID
[HttpDelete]
[HttpPost]
public IActionResult DeleteContainer(int id)
Parameters
idint
Returns
GetAll()
Gets the content json for all data types
[Authorize(Policy = "SectionAccessForDataTypeReading")]
public IEnumerable<DataTypeBasic>? GetAll()
Returns
- IEnumerable<DataTypeBasic>
Remarks
Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
GetAllPropertyEditors()
Gets all property editors defined
[Authorize(Policy = "SectionAccessForDataTypeReading")]
public IEnumerable<PropertyEditorBasic> GetAllPropertyEditors()
Returns
- IEnumerable<PropertyEditorBasic>
Remarks
Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
GetById(Guid)
Gets the datatype json for the datatype guid
public ActionResult<DataTypeDisplay?> GetById(Guid id)
Parameters
idGuid
Returns
- ActionResult<DataTypeDisplay>
GetById(int)
Gets the datatype json for the datatype id
public ActionResult<DataTypeDisplay?> GetById(int id)
Parameters
idint
Returns
- ActionResult<DataTypeDisplay>
GetById(Udi)
Gets the datatype json for the datatype udi
public ActionResult<DataTypeDisplay?> GetById(Udi id)
Parameters
idUdi
Returns
- ActionResult<DataTypeDisplay>
GetByName(string)
Gets data type by name
public DataTypeDisplay? GetByName(string name)
Parameters
namestring
Returns
- DataTypeDisplay
GetCustomListView(string)
Returns a custom listview, based on a content type alias, if found
public ActionResult<DataTypeDisplay?> GetCustomListView(string contentTypeAlias)
Parameters
contentTypeAliasstring
Returns
- ActionResult<DataTypeDisplay>
a DataTypeDisplay
GetEmpty(int)
public DataTypeDisplay? GetEmpty(int parentId)
Parameters
parentIdint
Returns
- DataTypeDisplay
GetGroupedDataTypes()
Returns all data types grouped by their property editor group
[Authorize(Policy = "SectionAccessForDataTypeReading")]
public IDictionary<string, IEnumerable<DataTypeBasic>>? GetGroupedDataTypes()
Returns
- IDictionary<string, IEnumerable<DataTypeBasic>>
Remarks
Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
GetGroupedPropertyEditors()
Returns all property editors grouped
[Authorize(Policy = "SectionAccessForDataTypeReading")]
public IDictionary<string, IEnumerable<DataTypeBasic>> GetGroupedPropertyEditors()
Returns
- IDictionary<string, IEnumerable<DataTypeBasic>>
Remarks
Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
GetPreValues(string, int)
Returns the pre-values for the specified property editor
public ActionResult<IEnumerable<DataTypeConfigurationFieldDisplay>> GetPreValues(string editorAlias, int dataTypeId = -1)
Parameters
Returns
- ActionResult<IEnumerable<DataTypeConfigurationFieldDisplay>>
GetReferences(int)
Returns the references (usages) for the data type
public DataTypeReferences GetReferences(int id)
Parameters
idint
Returns
- DataTypeReferences
HasValues(int)
[HttpGet]
public ActionResult<DataTypeHasValuesDisplay> HasValues(int id)
Parameters
idint
Returns
- ActionResult<DataTypeHasValuesDisplay>
PostCopy(MoveOrCopy)
public IActionResult PostCopy(MoveOrCopy copy)
Parameters
copyMoveOrCopy
Returns
PostCreateContainer(int, string)
public IActionResult PostCreateContainer(int parentId, string name)
Parameters
Returns
PostCreateCustomListView(string)
Creates a custom list view - give a document type alias
public DataTypeDisplay? PostCreateCustomListView(string contentTypeAlias)
Parameters
contentTypeAliasstring
Returns
- DataTypeDisplay
PostMove(MoveOrCopy)
Move the media type
public IActionResult PostMove(MoveOrCopy move)
Parameters
moveMoveOrCopy
Returns
PostRenameContainer(int, string)
public IActionResult PostRenameContainer(int id, string name)
Parameters
Returns
PostSave(DataTypeSave)
Saves the data type
public ActionResult<DataTypeDisplay?> PostSave(DataTypeSave dataType)
Parameters
dataTypeDataTypeSave
Returns
- ActionResult<DataTypeDisplay>