View Source
  Class DataTypeController
  
  The API controller used for editing data types
 
  
  
    Inheritance
      System.Object
      Microsoft.AspNetCore.Mvc.ControllerBase
      
      
      
      
      
      
   
  
  Assembly: Umbraco.Web.BackOffice.dll
  Syntax
  
    [Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public class DataTypeController : BackOfficeNotificationsController
   
  
  
  Constructors
  
  
    View Source
  
  DataTypeController(PropertyEditorCollection, IDataTypeService, IOptionsSnapshot<ContentSettings>, IUmbracoMapper, PropertyEditorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, ILocalizedTextService, IBackOfficeSecurityAccessor, IConfigurationEditorJsonSerializer)
  
  
  Declaration
  
    [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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | PropertyEditorCollection | 
        propertyEditors | 
         | 
      
      
        | IDataTypeService | 
        dataTypeService | 
         | 
      
      
        | Microsoft.Extensions.Options.IOptionsSnapshot<ContentSettings> | 
        contentSettings | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
      
        | PropertyEditorCollection | 
        propertyEditorCollection | 
         | 
      
      
        | IContentTypeService | 
        contentTypeService | 
         | 
      
      
        | IMediaTypeService | 
        mediaTypeService | 
         | 
      
      
        | IMemberTypeService | 
        memberTypeService | 
         | 
      
      
        | ILocalizedTextService | 
        localizedTextService | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backOfficeSecurityAccessor | 
         | 
      
      
        | IConfigurationEditorJsonSerializer | 
        serializer | 
         | 
      
    
  
  
    View Source
  
  DataTypeController(PropertyEditorCollection, IDataTypeService, IOptionsSnapshot<ContentSettings>, IUmbracoMapper, PropertyEditorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, ILocalizedTextService, IBackOfficeSecurityAccessor, IConfigurationEditorJsonSerializer, IDataTypeUsageService)
  
  
  Declaration
  
    [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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | PropertyEditorCollection | 
        propertyEditors | 
         | 
      
      
        | IDataTypeService | 
        dataTypeService | 
         | 
      
      
        | Microsoft.Extensions.Options.IOptionsSnapshot<ContentSettings> | 
        contentSettings | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
      
        | PropertyEditorCollection | 
        propertyEditorCollection | 
         | 
      
      
        | IContentTypeService | 
        contentTypeService | 
         | 
      
      
        | IMediaTypeService | 
        mediaTypeService | 
         | 
      
      
        | IMemberTypeService | 
        memberTypeService | 
         | 
      
      
        | ILocalizedTextService | 
        localizedTextService | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backOfficeSecurityAccessor | 
         | 
      
      
        | IConfigurationEditorJsonSerializer | 
        serializer | 
         | 
      
      
        | IDataTypeUsageService | 
        dataTypeUsageService | 
         | 
      
    
  
  Methods
  
  
    View Source
  
  DeleteById(Int32)
  Deletes a data type with a given ID
 
  
  Declaration
  
    [HttpDelete]
[HttpPost]
public IActionResult DeleteById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  DeleteContainer(Int32)
  Deletes a data type container with a given ID
 
  
  Declaration
  
    [HttpDelete]
[HttpPost]
public IActionResult DeleteContainer(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  GetAll()
  Gets the content json for all data types
 
  
  Declaration
  
    [Authorize(Policy = "SectionAccessForDataTypeReading")]
public IEnumerable<DataTypeBasic> GetAll()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<DataTypeBasic> | 
         | 
      
    
  
  
  
  
    View Source
  
  GetAllPropertyEditors()
  Gets all property editors defined
 
  
  Declaration
  
    [Authorize(Policy = "SectionAccessForDataTypeReading")]
public IEnumerable<PropertyEditorBasic> GetAllPropertyEditors()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<PropertyEditorBasic> | 
         | 
      
    
  
  
  
  
    View Source
  
  GetById(Guid)
  Gets the datatype json for the datatype guid
 
  
  Declaration
  
    public ActionResult<DataTypeDisplay?> GetById(Guid id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Guid | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DataTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Int32)
  Gets the datatype json for the datatype id
 
  
  Declaration
  
    public ActionResult<DataTypeDisplay?> GetById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DataTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Udi)
  Gets the datatype json for the datatype udi
 
  
  Declaration
  
    public ActionResult<DataTypeDisplay?> GetById(Udi id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Udi | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DataTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetByName(String)
  
  
  Declaration
  
    public DataTypeDisplay? GetByName(string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        name | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<DataTypeDisplay> | 
         | 
      
    
  
  
    View Source
  
  GetCustomListView(String)
  Returns a custom listview, based on a content type alias, if found
 
  
  Declaration
  
    public ActionResult<DataTypeDisplay?> GetCustomListView(string contentTypeAlias)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        contentTypeAlias | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DataTypeDisplay>> | 
        a DataTypeDisplay 
 | 
      
    
  
  
    View Source
  
  GetEmpty(Int32)
  
  
  Declaration
  
    public DataTypeDisplay? GetEmpty(int parentId)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        parentId | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<DataTypeDisplay> | 
         | 
      
    
  
  
    View Source
  
  GetGroupedDataTypes()
  Returns all data types grouped by their property editor group
 
  
  Declaration
  
    [Authorize(Policy = "SectionAccessForDataTypeReading")]
public IDictionary<string, IEnumerable<DataTypeBasic>> GetGroupedDataTypes()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IEnumerable<DataTypeBasic>> | 
         | 
      
    
  
  
  
  
    View Source
  
  GetGroupedPropertyEditors()
  Returns all property editors grouped
 
  
  Declaration
  
    [Authorize(Policy = "SectionAccessForDataTypeReading")]
public IDictionary<string, IEnumerable<DataTypeBasic>> GetGroupedPropertyEditors()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IEnumerable<DataTypeBasic>> | 
         | 
      
    
  
  
  
  
    View Source
  
  GetPreValues(String, Int32)
  Returns the pre-values for the specified property editor
 
  
  Declaration
  
    public ActionResult<IEnumerable<DataTypeConfigurationFieldDisplay>> GetPreValues(string editorAlias, int dataTypeId = -1)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        editorAlias | 
         | 
      
      
        | System.Int32 | 
        dataTypeId | 
        The data type id for the pre-values, -1 if it is a new data type 
 | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Collections.Generic.IEnumerable<DataTypeConfigurationFieldDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetReferences(Int32)
  Returns the references (usages) for the data type
 
  
  Declaration
  
    public DataTypeReferences GetReferences(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | DataTypeReferences | 
         | 
      
    
  
  
    View Source
  
  HasValues(Int32)
  
  
  Declaration
  
    [HttpGet]
public ActionResult<DataTypeHasValuesDisplay> HasValues(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<DataTypeHasValuesDisplay> | 
         | 
      
    
  
  
    View Source
  
  PostCopy(MoveOrCopy)
  
  
  Declaration
  
    public IActionResult PostCopy(MoveOrCopy copy)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MoveOrCopy | 
        copy | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCreateContainer(Int32, String)
  
  
  Declaration
  
    public IActionResult PostCreateContainer(int parentId, string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        parentId | 
         | 
      
      
        | System.String | 
        name | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCreateCustomListView(String)
  Creates a custom list view - give a document type alias
 
  
  Declaration
  
    public DataTypeDisplay? PostCreateCustomListView(string contentTypeAlias)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        contentTypeAlias | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<DataTypeDisplay> | 
         | 
      
    
  
  
    View Source
  
  PostMove(MoveOrCopy)
  
  
  Declaration
  
    public IActionResult PostMove(MoveOrCopy move)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MoveOrCopy | 
        move | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostRenameContainer(Int32, String)
  
  
  Declaration
  
    public IActionResult PostRenameContainer(int id, string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
      
        | System.String | 
        name | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostSave(DataTypeSave)
  
  
  Declaration
  
    public ActionResult<DataTypeDisplay?> PostSave(DataTypeSave dataType)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | DataTypeSave | 
        dataType | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DataTypeDisplay>> | 
         |