With Sitecore Content Hub DAM you have all your documents ready for your website. A big volume of content you want to manage and share throughout your digital platforms.
By Danny Paul van Iersel, 12-1-2024
Within Content Hub DAM you can manage all your assets and make it available on other platforms.
In this case we have created a full User Experience Portal to access assets where a logged in user has access to.
Through Sitecore Content Hub DAM we are able to configure documents add revisions and make it published to a website portal. Through the portal users can access the assets if they have the right access to the assets.
To bring the content from Content Hub DAM to a user friendly Portal there are multiple connections we can use to access the data.
The connections we will cover in this post are:
Next to these there are also 2 others:
The Web Client SDK it is easy to use and convert responses to your code objects.
We use this SDK to get the Assets from Content Hub. In doing so we directly have all the required options from an Asset.
From the asset we can then gather all the fields belonging to this for example the Life Cycle, file properties and mainly the Assets Renditions.
From the Renditions we are able to collect the Original file but also the Preview file or any other rendition that has been created for the document.
During our development we did notice in our Content Hub structure it was very consuming to retrieve all our data to display on a website. Our custom schema items and taxonomies with there relations took too much resources and time to perform for our customer.
Therefore for all data collection other then specific assets data we switched and started to use GraphQL.
Content Hub made it possible to use GraphQL IDE. This IDE can expose 2 API’s:
In order to use the GraphQL IDE you will need to create an API Key in Content Hub to use with the API Calls.
There is also an interesting feature you can access through the browser and it is called Playground
Playground to test your queries:
https://<<YOUR ContentHub URL>>/api/graphql/preview/ide/
It also comes with intellisense. This gives you the schema properties that are available.
By using GraphQL we have a big optimization for performance. We collect a lot of data and many relations to achieve our goal.
There are many additional API’s that Content Hub has available.
You can use the API’s to retrieve data from Content Hub, but it will be more difficult if you have complex queries.
The API can be used to externally modify Content Hub data, for example if you have an import script to update changes from other systems.
Also it gives you the option to upload files or retrieve Fetch Job information.
In our case we are required to send out emails to external users of our Portal. These users are not known in Content Hub.
In the email we notify users what the changes have been on the documents they have access to.
To do this we need to know all changes that have been done in Content Hub in the last x amount of days. This can be in the last week or last month, depending on if the user wants weekly or monthly notifications.
We are using the Audit Endpoint “/api/audit”. Example url https://<<your Content Hub URL>>/api/audit/raw/query{/entityId}{?eventTypes*,definitionNames*,userIds*,properties*,relations*,culture,from,to,fullText,skip,take,sort,order}
To be able to retrieve information through this method we first need to authenticate. This goes through the Endpoint “/api/authenticate”. The response will give you a Token, and you use this token to call the Audit endpoint with the header “X-Auth-Token”.
Now we can request the audit data. We can use the following parameters for our query:
Parameter |
Description |
EntityId |
User for specific entity |
DefinitionNames |
Can be used to gather all audit of a specific definition |
From |
Start time to retrieve data from |
To |
End time to retrieve data till |
Skip |
The amount to skip |
Take |
The amount to take |
Sort |
The field on what to sort |
Order |
Order of sorting: asc or desc |
EventTypes |
Type of the Audit event (EntityUpdated, EntityCreated etc.) |
UserIds |
Id of the user that belongs to the Audit event |
Properties |
Filters on the requested properties. Only gives result based on requested properties. |
Relations |
Filters on the requested relations. Only results of changes done the requested relations |
Culture |
Culture for the response data |
An example of the response you can expect:
When the response gives you data of event type “EntityUpdated”, you can find what property has been changed. Also you will see wat the value was before the change and what is has been changed into.
You see there are many ways you can go and get the results you want. You are not limited to only the system you are using. Extending the use of your DAM system can be a valuable asset for you. There are endless possibilities, for internal or external purposes.
Do you have questions or are you stuck setting up your environment? Do you want to extend your own DAM system and reach more potential with the data you already have?
Let us get in contact and see how we can accomplish your goals.
Ready to take your digital experience to the next level? Feel free to contact us to learn more about our services and how we can help you leverage the full potential of your digital marketing.
Get in touch with one of our consultants to find the perfect match that fits your needs and enables you to grow.