Friday 14 August 2020

Sitecore Content Hub For Developers Introduction

 In this series of Sitecore Content Hub for developers, I'll share with you all the information you need to start working and getting familiar with Sitecore Content Hub and specially I'll focus on the areas related to developers, you probably familiar with the different modules that Sitecore Content Hub Offers, Digital Asset Management (DAM),  Content Marketing Platform (CMP), Product Content Management (PCM) and Marketing Resource Management (MRM), if you're not still familiar with these, thats fine, check this article to get an idea. 

In this post and coming posts of Sitecore Content Hub for Developers we will discuss Schema, Entities, Scripts, Actions, Triggers, REST API, Azure Functions, Package export/import, in addition of how you can have IntelliSense while using Stylelabs SDK.

Sitecore Content Hub offers a flexible architecture through internal and external integration architecture that gives the ability to have some custom actions over its entities as example, with internal integration we have scripts, actions, triggers and external page components, and for external integration we have a Web SDK as well as Rest API, in addition of course to the import/export package tool. 


Entity

The Entity represents the data in Sitecore Content Hub, an entity is an instance of Entity Definition, which we can imagine it as template and items out of a template in Sitecore, we can define Entity definitions through the schema section in Sitecore Content Hub Admin, and then add Entities out of that created Entity definition, as example, an asset in Content Hub is an Entity out of the M.Asset Entity definition. 

When adding a new Entity Definition, you can define properties which can be a regular property (string, long, Datetime), a relation (with another Entity)  or a Taxonomy. 


Scripts?

Sitecore Content Hub gives you the ability to create a C# script blocks that can be triggered when an Entity get created, updated or deleted, the C# script can use the SDK to create, edit, delete and query Sitecore Content Hub entities.



Actions?

Actions in Sitecore Hub represents a task to be executed, this task can be linked to a scrip, API call, Azure event hub, service bus...etc, this action can be triggered using a trigger that we will talk about it in the next section.



Triggers?

In Sitecore Content Hub you can define triggers to trigger one or more actions on specific user events, as example when entity is created, updated or deleted, also, in case of entity update, you can specifically what kind of updates you are monitoring, like when a specific field change or when specific field has a specific value.

Also, there are two types of execution, you can use In Process or In Background execution of your action, the In Process execution types has 5 different execution phases, Pre-commit, validation, security , audit and Post, you can get more information here



REST API?

The REST API is a Hypermedia API built on top of HTTP. All objects in Sitecore Content Hub are modeled as resources that represent the state of the objects at the time of a request.

An example on REST API is if you want to create a script using REST API post call, so you would need the following URL and passing in the request body the needed parameters:

https://ContentHubHost/api/entitydefinitions/M.Script/entities


Web Client SDK?

Sitecore/Stylelabs provides a Nuget package that can be used to import the web SDK, then using the oAuth 2.0 to perform the authorization, we can use the SDK to perform operation in Sitecore Content Hub.

Export/Import Packages?

Sitecore Content Hub provides approaches for moving your changes from one environment to another through export/import functionality, when working with Content Hub structure like Entity definitions, Scripts, triggers, taxonomies...etc we can use the import/export that will generate a zip folder with Json files from source environment and import it in the target environment. 


For Assets items, we also can generate a package using export functionality using the selection page component on the target environment,  and on the other side, we can use selection component to import these items, as for its meta data we will need to use excel export/import. 


Hope the above will give you a good introduction into the different areas of Sitecore Content Hub which I believe a developer should be familiar with.

No comments:

Post a Comment