Backend - Alpha Solutions

In this Alpha Solutions Tech Tip, we walk you through the process of adding entities and schemas to the UI for each.

13.2.20

AF NIKET ASHESH

I got a little curious about how many entities there are in Content Hub and what their schemas look like.

First, I headed to the Entities page:

Screenshot of Entities page, listing Content Hub entities

And then to Schema page:

Screenshot of Schema page, listing Content Hub schemas

Screenshot of Schema page detail, showing the M.Asset info

While the page gave me some of the information I was looking for, it did not show all the entities. For instance M.Mailing.Template is missing. As per the Content Hub documentation , you can add the missing types by making some configuration changes.

However, this should be done with caution.

From the documentation:

The list of Entity definitions shown in the Entity Manager can be restricted within the system settings (category: portal configuration) in order to avoid unwanted or misconfiguration. The restriction itself should be executed by a technical administrator.

Important Note: Proceed carefully when using this admin tool, as using it without the required knowledge might cause unexpected system behavior or system instability.


Changing configurations is not always ideal, and I did not want to change anything in the UI. However, I noticed a pattern in the URLs:

<base URL> /en-us/admin/definitionmgmt/detail/40 took me to the M.Asset schema page.

<base URL> /en-us/admin/definitionmgmt/detail/3 took me to the UserProfile schema page.

So, being a coder, I took the simpler approach:

// Create the Web SDK client
                IWebMClient client = Helper.GetWebMClient(); 

                var entityDefinitionIds = await client.EntityDefinitions.GetRangeIdsAsync(0, 1);

                var numberOfPages = Math.Ceiling(((double)entityDefinitionIds.TotalNumberOfResults / 25)); // using 25 as that is the default size
                List<string> definitionNames = new List<string>();
                for (int i = 0; i < numberOfPages; i += 1)
                {
                    var entityDefinitions = await client.EntityDefinitions.GetRangeAsync(i * 25);
                    definitionNames.AddRange(entityDefinitions.Items.Select((item, index) => $"{(index + 1) + (i * 25)}. {item.Name}"));
                }

Note: The API limits the number of results to optimize performance, which is why the number 25 is used.

This code gave me a result like this:

Screenshot listing configuration IDs

Now that I had the IDs, all I had to do was change the URL:

Link to M.Mailing.Template schema: en-us/admin/definitionmgmt/detail/14

Of course, I could get the details I was looking for in the code itself, but browsing the UI is more intuitive and more efficient, once the needed details are added.