View Source
Class EntityController
The API controller used for getting entity objects, basic name, icon, id representation of umbraco objects that are based on CMSNode
Inheritance
System.Object
Assembly: Umbraco.Web.dll
Syntax
[PluginController("UmbracoApi")]
public class EntityController : UmbracoAuthorizedJsonController, IDiscoverable
Constructors
View Source
EntityController(IGlobalSettings, IUmbracoContextAccessor, ISqlContext, ServiceContext, AppCaches, IProfilingLogger, IRuntimeState, ITreeService, UmbracoHelper, SearchableTreeCollection, UmbracoTreeSearcher)
Declaration
public EntityController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, ITreeService treeService, UmbracoHelper umbracoHelper, SearchableTreeCollection searchableTreeCollection, UmbracoTreeSearcher treeSearcher)
Parameters
Methods
View Source
GetAll(UmbracoEntityTypes, String)
Declaration
public IEnumerable<EntityBasic> GetAll(UmbracoEntityTypes type, string postFilter)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetAncestors(Int32, UmbracoEntityTypes, FormDataCollection)
Declaration
public IEnumerable<EntityBasic> GetAncestors(int id, UmbracoEntityTypes type, FormDataCollection queryStrings)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
UmbracoEntityTypes |
type |
|
FormDataCollection |
queryStrings |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetAnchors(AnchorsModel)
Declaration
public IEnumerable<string> GetAnchors(AnchorsModel model)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.String> |
|
View Source
GetById(Guid, UmbracoEntityTypes)
Gets an entity by it's key
Declaration
public EntityBasic GetById(Guid id, UmbracoEntityTypes type)
Parameters
Returns
View Source
GetById(Int32, UmbracoEntityTypes)
Gets an entity by it's id
Declaration
public EntityBasic GetById(int id, UmbracoEntityTypes type)
Parameters
Returns
View Source
GetById(Udi, UmbracoEntityTypes)
Gets an entity by it's UDI
Declaration
public EntityBasic GetById(Udi id, UmbracoEntityTypes type)
Parameters
Returns
View Source
GetByIds(Guid[], UmbracoEntityTypes)
Declaration
public IEnumerable<EntityBasic> GetByIds(Guid[] ids, UmbracoEntityTypes type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetByIds(Int32[], UmbracoEntityTypes)
Get entities by integer ids
Declaration
public IEnumerable<EntityBasic> GetByIds(int[] ids, UmbracoEntityTypes type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetByIds(Udi[], UmbracoEntityTypes)
Declaration
public IEnumerable<EntityBasic> GetByIds(Udi[] ids, UmbracoEntityTypes type)
Parameters
Type |
Name |
Description |
Udi[] |
ids |
A list of UDIs to lookup items by, all UDIs must be of the same UDI type!
|
UmbracoEntityTypes |
type |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetByQuery(String, Int32, UmbracoEntityTypes)
Gets an entity by a xpath query
Declaration
public EntityBasic GetByQuery(string query, int nodeContextId, UmbracoEntityTypes type)
Parameters
Type |
Name |
Description |
System.String |
query |
|
System.Int32 |
nodeContextId |
|
UmbracoEntityTypes |
type |
|
Returns
View Source
GetChildren(Int32, UmbracoEntityTypes, Nullable<Guid>)
Declaration
public IEnumerable<EntityBasic> GetChildren(int id, UmbracoEntityTypes type, Guid? dataTypeKey = null)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
UmbracoEntityTypes |
type |
|
System.Nullable<System.Guid> |
dataTypeKey |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
GetPagedChildren(Int32, UmbracoEntityTypes, Int32, Int32, String, Direction, String, Nullable<Guid>)
Get paged child entities by id
Declaration
public PagedResult<EntityBasic> GetPagedChildren(int id, UmbracoEntityTypes type, int pageNumber, int pageSize, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "", Guid? dataTypeKey = null)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
UmbracoEntityTypes |
type |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.String |
filter |
|
System.Nullable<System.Guid> |
dataTypeKey |
|
Returns
View Source
GetPagedChildren(String, UmbracoEntityTypes, Int32, Int32, String, Direction, String, Nullable<Guid>)
Get paged child entities by id
Declaration
public PagedResult<EntityBasic> GetPagedChildren(string id, UmbracoEntityTypes type, int pageNumber, int pageSize, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "", Guid? dataTypeKey = null)
Parameters
Type |
Name |
Description |
System.String |
id |
|
UmbracoEntityTypes |
type |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.String |
filter |
|
System.Nullable<System.Guid> |
dataTypeKey |
|
Returns
View Source
GetPagedDescendants(Int32, UmbracoEntityTypes, Int32, Int32, String, Direction, String, Nullable<Guid>)
Declaration
public PagedResult<EntityBasic> GetPagedDescendants(int id, UmbracoEntityTypes type, int pageNumber, int pageSize, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "", Guid? dataTypeKey = null)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
UmbracoEntityTypes |
type |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.String |
filter |
|
System.Nullable<System.Guid> |
dataTypeKey |
|
Returns
View Source
GetPath(Guid, UmbracoEntityTypes)
Gets the path for a given node ID
Declaration
public IEnumerable<int> GetPath(Guid id, UmbracoEntityTypes type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
View Source
GetPath(Int32, UmbracoEntityTypes)
Gets the path for a given node ID
Declaration
public IEnumerable<int> GetPath(int id, UmbracoEntityTypes type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
View Source
GetPath(Udi, UmbracoEntityTypes)
Gets the path for a given node ID
Declaration
public IEnumerable<int> GetPath(Udi id, UmbracoEntityTypes type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
|
View Source
GetSafeAlias(String, Boolean)
Returns an Umbraco alias given a string
Declaration
public dynamic GetSafeAlias(string value, bool camelCase = true)
Parameters
Type |
Name |
Description |
System.String |
value |
|
System.Boolean |
camelCase |
|
Returns
Type |
Description |
System.Object |
|
View Source
GetUrl(Int32, UmbracoEntityTypes, String)
Gets the URL of an entity
Declaration
public HttpResponseMessage GetUrl(int id, UmbracoEntityTypes type, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
Int id of the entity to fetch URL for
|
UmbracoEntityTypes |
type |
The type of entity such as Document, Media, Member
|
System.String |
culture |
The culture to fetch the URL for
|
Returns
Type |
Description |
HttpResponseMessage |
The URL or path to the item
|
View Source
GetUrl(Udi, String)
Gets the URL of an entity
Declaration
public HttpResponseMessage GetUrl(Udi udi, string culture = "*")
Parameters
Type |
Name |
Description |
Udi |
udi |
UDI of the entity to fetch URL for
|
System.String |
culture |
The culture to fetch the URL for
|
Returns
Type |
Description |
HttpResponseMessage |
The URL or path to the item
|
View Source
GetUrlAndAnchors(Int32, String)
Declaration
public UrlAndAnchors GetUrlAndAnchors(int id, string culture = "*")
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
culture |
|
Returns
View Source
GetUrlAndAnchors(Udi, String)
Declaration
public UrlAndAnchors GetUrlAndAnchors(Udi id, string culture = "*")
Parameters
Type |
Name |
Description |
Udi |
id |
|
System.String |
culture |
|
Returns
View Source
GetUrlsByIds(Guid[], UmbracoEntityTypes, String)
Declaration
public IDictionary<Guid, string> GetUrlsByIds(Guid[] ids, UmbracoEntityTypes type, string culture = null)
Parameters
Type |
Name |
Description |
System.Guid[] |
ids |
A list of IDs to lookup items by
|
UmbracoEntityTypes |
type |
The entity type to look for.
|
System.String |
culture |
The culture to fetch the URL for.
|
Returns
Type |
Description |
System.Collections.Generic.IDictionary<System.Guid, System.String> |
Dictionary mapping Udi -> Url
|
View Source
GetUrlsByIds(Int32[], UmbracoEntityTypes, String)
Declaration
public IDictionary<int, string> GetUrlsByIds(int[] ids, UmbracoEntityTypes type, string culture = null)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
A list of IDs to lookup items by
|
UmbracoEntityTypes |
type |
The entity type to look for.
|
System.String |
culture |
The culture to fetch the URL for.
|
Returns
Type |
Description |
System.Collections.Generic.IDictionary<System.Int32, System.String> |
Dictionary mapping Udi -> Url
|
View Source
GetUrlsByIds(Udi[], UmbracoEntityTypes, String)
Declaration
public IDictionary<Udi, string> GetUrlsByIds(Udi[] ids, UmbracoEntityTypes type, string culture = null)
Parameters
Type |
Name |
Description |
Udi[] |
ids |
A list of IDs to lookup items by
|
UmbracoEntityTypes |
type |
The entity type to look for.
|
System.String |
culture |
The culture to fetch the URL for.
|
Returns
Type |
Description |
System.Collections.Generic.IDictionary<Udi, System.String> |
Dictionary mapping Udi -> Url
|
View Source
Search(String, UmbracoEntityTypes, String, Nullable<Guid>)
Searches for results based on the entity type
Declaration
public IEnumerable<EntityBasic> Search(string query, UmbracoEntityTypes type, string searchFrom = null, Guid? dataTypeKey = null)
Parameters
Type |
Name |
Description |
System.String |
query |
|
UmbracoEntityTypes |
type |
|
System.String |
searchFrom |
A starting point for the search, generally a node id, but for members this is a member type alias
|
System.Nullable<System.Guid> |
dataTypeKey |
If set used to look up whether user and group start node permissions will be ignored.
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<EntityBasic> |
|
View Source
SearchAll(String)
Searches for all content that the user is allowed to see (based on their allowed sections)
Declaration
public IDictionary<string, TreeSearchResult> SearchAll(string query)
Parameters
Type |
Name |
Description |
System.String |
query |
|
Returns
Type |
Description |
System.Collections.Generic.IDictionary<System.String, TreeSearchResult> |
|