View Source
Class ContentController
The API controller used for editing content
Inheritance
System.Object
Microsoft.AspNetCore.Mvc.ControllerBase
Assembly: Umbraco.Web.BackOffice.dll
Syntax
[PluginController("UmbracoApi")]
[Authorize(Policy = "TreeAccessDocuments")]
public class ContentController : ContentControllerBase, IUmbracoFeature, IDiscoverable
Constructors
View Source
ContentController(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, PropertyEditorCollection, IContentService, IUserService, IBackOfficeSecurityAccessor, IContentTypeService, IUmbracoMapper, IPublishedUrlProvider, IDomainService, IDataTypeService, ILocalizationService, IFileService, INotificationService, ActionCollection, ISqlContext, IJsonSerializer, ICoreScopeProvider, IAuthorizationService, IContentVersionService)
Declaration
public ContentController(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, PropertyEditorCollection propertyEditors, IContentService contentService, IUserService userService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IContentTypeService contentTypeService, IUmbracoMapper umbracoMapper, IPublishedUrlProvider publishedUrlProvider, IDomainService domainService, IDataTypeService dataTypeService, ILocalizationService localizationService, IFileService fileService, INotificationService notificationService, ActionCollection actionCollection, ISqlContext sqlContext, IJsonSerializer serializer, ICoreScopeProvider scopeProvider, IAuthorizationService authorizationService, IContentVersionService contentVersionService)
Parameters
View Source
ContentController(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, PropertyEditorCollection, IContentService, IUserService, IBackOfficeSecurityAccessor, IContentTypeService, IUmbracoMapper, IPublishedUrlProvider, IDomainService, IDataTypeService, ILocalizationService, IFileService, INotificationService, ActionCollection, ISqlContext, IJsonSerializer, ICoreScopeProvider, IAuthorizationService, IContentVersionService, ICultureImpactFactory)
Declaration
[ActivatorUtilitiesConstructor]
public ContentController(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, PropertyEditorCollection propertyEditors, IContentService contentService, IUserService userService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IContentTypeService contentTypeService, IUmbracoMapper umbracoMapper, IPublishedUrlProvider publishedUrlProvider, IDomainService domainService, IDataTypeService dataTypeService, ILocalizationService localizationService, IFileService fileService, INotificationService notificationService, ActionCollection actionCollection, ISqlContext sqlContext, IJsonSerializer serializer, ICoreScopeProvider scopeProvider, IAuthorizationService authorizationService, IContentVersionService contentVersionService, ICultureImpactFactory cultureImpactFactory)
Parameters
Properties
View Source
Domains
Declaration
public object Domains { get; }
Property Value
Type |
Description |
System.Object |
|
Methods
View Source
CreateBlueprintFromContent(Int32, String)
Creates a blueprint from a content item
Declaration
[Authorize(Policy = "ContentPermissionCreateBlueprintFromId")]
[HttpPost]
public ActionResult<SimpleNotificationModel> CreateBlueprintFromContent([FromQuery] int contentId, [FromQuery] string name)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
The content id to copy
|
System.String |
name |
The name of the blueprint
|
Returns
View Source
DeleteBlueprint(Int32)
Declaration
[Authorize(Policy = "TreeAccessDocumentTypes")]
[HttpDelete]
[HttpPost]
public IActionResult DeleteBlueprint(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
DeleteById(Int32)
Moves an item to the recycle bin, if it is already there then it will permanently delete it
Declaration
[Authorize(Policy = "ContentPermissionDeleteById")]
[HttpDelete]
[HttpPost]
public IActionResult DeleteById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
EmptyRecycleBin()
Declaration
[HttpDelete]
[HttpPost]
[Authorize(Policy = "ContentPermissionEmptyRecycleBin")]
public IActionResult EmptyRecycleBin()
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
GetBlueprintById(Int32)
Declaration
public ActionResult<ContentItemDisplay> GetBlueprintById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetById(Guid)
Gets the content json for the content guid
Declaration
[Authorize(Policy = "ContentPermissionBrowseById")]
public ActionResult<ContentItemDisplayWithSchedule> GetById(Guid id)
Parameters
Type |
Name |
Description |
Guid |
id |
|
Returns
View Source
GetById(Int32)
Gets the content json for the content id
Declaration
[Authorize(Policy = "ContentPermissionBrowseById")]
public ActionResult<ContentItemDisplayWithSchedule> GetById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetById(Udi)
Gets the content json for the content udi
Declaration
[Authorize(Policy = "ContentPermissionBrowseById")]
public ActionResult<ContentItemDisplayWithSchedule> GetById(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
View Source
GetByIds(Int32[])
Return content for the specified ids
Declaration
public IEnumerable<ContentItemDisplay> GetByIds([FromQuery] int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
|
Returns
View Source
GetChildren(Int32, String, Int32, Int32, String, Direction, Boolean, String, String)
Gets the children for the content id passed in
Declaration
public PagedResult<ContentItemBasic<ContentPropertyBasic>> GetChildren(int id, string includeProperties, int pageNumber = 0, int pageSize = 0, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "", string cultureName = "")
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
includeProperties |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.Boolean |
orderBySystemField |
|
System.String |
filter |
|
System.String |
cultureName |
|
Returns
View Source
GetCultureAndDomains(Int32)
Declaration
public ContentDomainsAndCulture GetCultureAndDomains(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetDetailedPermissions(Int32)
Returns the user group permissions for user groups assigned to this node
Declaration
[Authorize(Policy = "ContentPermissionAdministrationById")]
public ActionResult<IEnumerable<AssignedUserGroupPermissions>?> GetDetailedPermissions(int contentId)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
Returns
View Source
GetEmpty(String, Int32)
Gets an empty content item for the document type.
Declaration
public ActionResult<ContentItemDisplay> GetEmpty(string contentTypeAlias, int parentId)
Parameters
Type |
Name |
Description |
System.String |
contentTypeAlias |
|
System.Int32 |
parentId |
|
Returns
View Source
GetEmptyBlueprint(Int32, Int32)
Declaration
public ActionResult<ContentItemDisplay> GetEmptyBlueprint(int blueprintId, int parentId)
Parameters
Type |
Name |
Description |
System.Int32 |
blueprintId |
|
System.Int32 |
parentId |
|
Returns
View Source
GetEmptyByAliases(ContentTypesByAliases)
Gets a dictionary containing empty content items for every alias specified in the contentTypeAliases array in the
body of the request.
Declaration
[HttpPost]
public ActionResult<IDictionary<string, ContentItemDisplay>> GetEmptyByAliases(ContentTypesByAliases contentTypesByAliases)
Parameters
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.ActionResult<IDictionary<System.String, ContentItemDisplay>> |
|
View Source
GetEmptyByKey(Guid, Int32)
Gets an empty content item for the document type.
Declaration
public ActionResult<ContentItemDisplay> GetEmptyByKey(Guid contentTypeKey, int parentId)
Parameters
Type |
Name |
Description |
Guid |
contentTypeKey |
|
System.Int32 |
parentId |
|
Returns
View Source
GetEmptyByKeys(Guid[], Int32)
Gets a collection of empty content items for all document types.
Declaration
public ActionResult<IDictionary<Guid, ContentItemDisplay>> GetEmptyByKeys([FromQuery] Guid[] contentTypeKeys, [FromQuery] int parentId)
Parameters
Type |
Name |
Description |
Guid[] |
contentTypeKeys |
|
System.Int32 |
parentId |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.ActionResult<IDictionary<Guid, ContentItemDisplay>> |
|
View Source
GetEmptyByKeys(ContentTypesByKeys)
Gets a collection of empty content items for all document types.
Declaration
[HttpPost]
public ActionResult<IDictionary<Guid, ContentItemDisplay>> GetEmptyByKeys(ContentTypesByKeys contentTypeByKeys)
Parameters
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.ActionResult<IDictionary<Guid, ContentItemDisplay>> |
|
View Source
GetNiceUrl(Guid)
Gets the Url for a given node ID
Declaration
public IActionResult GetNiceUrl(Guid id)
Parameters
Type |
Name |
Description |
Guid |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
GetNiceUrl(Int32)
Gets the Url for a given node ID
Declaration
public IActionResult GetNiceUrl(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
GetNiceUrl(Udi)
Gets the Url for a given node ID
Declaration
public IActionResult GetNiceUrl(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
GetNotificationOptions(Int32)
Declaration
[Authorize(Policy = "ContentPermissionBrowseById")]
public ActionResult<IEnumerable<NotifySetting>> GetNotificationOptions(int contentId)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.ActionResult<IEnumerable<NotifySetting>> |
|
View Source
GetPagedContentVersions(Int32, Int32, Int32, String)
Declaration
[HttpGet]
[JsonCamelCaseFormatter]
public IActionResult GetPagedContentVersions(int contentId, int pageNumber = 1, int pageSize = 10, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
culture |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
GetRecycleBin()
Returns an item to be used to display the recycle bin for content
Declaration
public ActionResult<ContentItemDisplay> GetRecycleBin()
Returns
View Source
GetRollbackVersion(Int32, String)
Declaration
[HttpGet]
public ContentVariantDisplay GetRollbackVersion(int versionId, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32 |
versionId |
|
System.String |
culture |
|
Returns
View Source
GetRollbackVersions(Int32, String)
Declaration
[HttpGet]
public IEnumerable<RollbackVersion> GetRollbackVersions(int contentId, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
System.String |
culture |
|
Returns
View Source
PostCopy(MoveOrCopy)
Copies a content item and places the copy as a child of a given parent Id
Declaration
public async Task<ActionResult<IContent>> PostCopy(MoveOrCopy copy)
Parameters
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.ActionResult<IContent>> |
|
View Source
PostMove(MoveOrCopy)
Change the sort order for media
Declaration
public async Task<IActionResult> PostMove(MoveOrCopy move)
Parameters
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.IActionResult> |
|
View Source
PostNotificationOptions(Int32, String[])
Declaration
public IActionResult PostNotificationOptions(int contentId, [FromQuery(Name = "notifyOptions[]")] string[] notifyOptions)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
System.String[] |
notifyOptions |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
PostPublishById(Int32)
Publishes a document with a given ID
Declaration
[Authorize(Policy = "ContentPermissionPublishById")]
public IActionResult PostPublishById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
PostPublishByIdAndCulture(PublishContent)
Publishes a document with a given ID and cultures.
Declaration
[Authorize(Policy = "ContentPermissionPublishById")]
public IActionResult PostPublishByIdAndCulture(PublishContent model)
Parameters
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
Remarks
View Source
PostRollbackContent(Int32, Int32, String)
Declaration
[Authorize(Policy = "ContentPermissionRollbackById")]
[HttpPost]
public IActionResult PostRollbackContent(int contentId, int versionId, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
System.Int32 |
versionId |
|
System.String |
culture |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
PostSave(ContentItemSave)
Declaration
[FileUploadCleanupFilter(true)]
[ContentSaveValidation(false)]
public async Task<ActionResult<ContentItemDisplay<ContentVariantScheduleDisplay>>> PostSave([ModelBinder(typeof(ContentItemBinder))] ContentItemSave contentItem)
Parameters
Returns
View Source
PostSaveBlueprint(ContentItemSave)
Declaration
[Authorize(Policy = "TreeAccessDocumentTypes")]
[FileUploadCleanupFilter(true)]
[ContentSaveValidation(true)]
public async Task<ActionResult<ContentItemDisplay<ContentVariantDisplay>>> PostSaveBlueprint([ModelBinder(typeof(BlueprintItemBinder))] ContentItemSave contentItem)
Parameters
Returns
View Source
PostSaveLanguageAndDomains(DomainSave)
Declaration
[HttpPost]
public ActionResult<DomainSave> PostSaveLanguageAndDomains(DomainSave model)
Parameters
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.ActionResult<DomainSave> |
|
View Source
PostSaveUserGroupPermissions(UserGroupPermissionsSave)
Updates the permissions for a content item for a particular user group
Declaration
public async Task<ActionResult<IEnumerable<AssignedUserGroupPermissions>?>> PostSaveUserGroupPermissions(UserGroupPermissionsSave saveModel)
Parameters
Returns
View Source
PostSetContentVersionPreventCleanup(Int32, Int32, Boolean)
Declaration
[HttpPost]
[Authorize(Policy = "ContentPermissionAdministrationById")]
public IActionResult PostSetContentVersionPreventCleanup(int contentId, int versionId, bool preventCleanup)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
|
System.Int32 |
versionId |
|
System.Boolean |
preventCleanup |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
PostSort(ContentSortOrder)
Change the sort order for content
Declaration
public async Task<IActionResult> PostSort(ContentSortOrder sorted)
Parameters
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.IActionResult> |
|
View Source
PostUnpublish(UnpublishContent)
Unpublishes a node with a given Id and returns the unpublished entity
Declaration
public async Task<ActionResult<ContentItemDisplayWithSchedule>> PostUnpublish(UnpublishContent model)
Parameters
Type |
Name |
Description |
UnpublishContent |
model |
The content and variants to unpublish
|
Returns