Table of Contents

Class DictionaryController

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

The API controller used for editing dictionary items

[Authorize(Policy = "TreeAccessDictionary")]
public class DictionaryController : BackOfficeNotificationsController
Inheritance
DictionaryController
Inherited Members

Remarks

The security for this controller is defined to allow full CRUD access to dictionary if the user has access to either: Dictionary

Constructors

DictionaryController(ILogger<DictionaryController>, ILocalizationService, IBackOfficeSecurityAccessor, IOptionsSnapshot<GlobalSettings>, ILocalizedTextService, IUmbracoMapper)

[Obsolete("Please use ctor that also takes an IEntityXmlSerializer, IHostingEnvironment & PackageDataInstallation instead, scheduled for removal in v12")]
public DictionaryController(ILogger<DictionaryController> logger, ILocalizationService localizationService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IOptionsSnapshot<GlobalSettings> globalSettings, ILocalizedTextService localizedTextService, IUmbracoMapper umbracoMapper)

Parameters

logger ILogger<DictionaryController>
localizationService ILocalizationService
backofficeSecurityAccessor IBackOfficeSecurityAccessor
globalSettings IOptionsSnapshot<GlobalSettings>
localizedTextService ILocalizedTextService
umbracoMapper IUmbracoMapper

DictionaryController(ILogger<DictionaryController>, ILocalizationService, IBackOfficeSecurityAccessor, IOptionsSnapshot<GlobalSettings>, ILocalizedTextService, IUmbracoMapper, IEntityXmlSerializer, IHostingEnvironment, PackageDataInstallation)

[ActivatorUtilitiesConstructor]
public DictionaryController(ILogger<DictionaryController> logger, ILocalizationService localizationService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IOptionsSnapshot<GlobalSettings> globalSettings, ILocalizedTextService localizedTextService, IUmbracoMapper umbracoMapper, IEntityXmlSerializer serializer, IHostingEnvironment hostingEnvironment, PackageDataInstallation packageDataInstallation)

Parameters

logger ILogger<DictionaryController>
localizationService ILocalizationService
backofficeSecurityAccessor IBackOfficeSecurityAccessor
globalSettings IOptionsSnapshot<GlobalSettings>
localizedTextService ILocalizedTextService
umbracoMapper IUmbracoMapper
serializer IEntityXmlSerializer
hostingEnvironment IHostingEnvironment
packageDataInstallation PackageDataInstallation

Methods

Create(int, string)

Creates a new dictionary item

[HttpPost]
public ActionResult<int> Create(int parentId, string key)

Parameters

parentId int

The parent id.

key string

The key.

Returns

ActionResult<int>

The HttpResponseMessage.

DeleteById(int)

Deletes a data type with a given ID

[HttpDelete]
[HttpPost]
public IActionResult DeleteById(int id)

Parameters

id int

Returns

IActionResult

HttpResponseMessage

ExportDictionary(int, bool)

public IActionResult ExportDictionary(int id, bool includeChildren = false)

Parameters

id int
includeChildren bool

Returns

IActionResult

GetById(Guid)

Gets a dictionary item by guid

public ActionResult<DictionaryDisplay?> GetById(Guid id)

Parameters

id Guid

The id.

Returns

ActionResult<DictionaryDisplay>

The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist

GetById(int)

Gets a dictionary item by id

public ActionResult<DictionaryDisplay?> GetById(int id)

Parameters

id int

The id.

Returns

ActionResult<DictionaryDisplay>

The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist

GetById(Udi)

Gets a dictionary item by udi

public ActionResult<DictionaryDisplay?> GetById(Udi id)

Parameters

id Udi

The id.

Returns

ActionResult<DictionaryDisplay>

The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay. Returns a not found response when dictionary item does not exist

GetList()

Retrieves a list with all dictionary items

public IEnumerable<DictionaryOverviewDisplay> GetList()

Returns

IEnumerable<DictionaryOverviewDisplay>

The IEnumerable<T>.

ImportDictionary(string, int)

public IActionResult ImportDictionary(string file, int parentId)

Parameters

file string
parentId int

Returns

IActionResult

PostMove(MoveOrCopy)

Changes the structure for dictionary items

public IActionResult? PostMove(MoveOrCopy move)

Parameters

move MoveOrCopy

Returns

IActionResult

PostSave(DictionarySave)

Saves a dictionary item

public ActionResult<DictionaryDisplay?> PostSave(DictionarySave dictionary)

Parameters

dictionary DictionarySave

The dictionary.

Returns

ActionResult<DictionaryDisplay>

The Umbraco.Cms.Core.Models.ContentEditing.DictionaryDisplay.

Upload(IFormFile)

public ActionResult<DictionaryImportModel> Upload(IFormFile file)

Parameters

file IFormFile

Returns

ActionResult<DictionaryImportModel>