Digizuite DAM integration service provides an API where integration endpoints can register for notifications regarding asset and metadata changes. We have made it easy to setup the connection between Episerver and Digizuite. All you have to do it is to add some configuration in the web.config - and you your Episerver instance will recive receive notifications from Digizuite whenever and an asset changes.
In Episerver we have created a new ApiController, which is located at the following route [siteUrl]/digizuite/integration, this it . This is the endpoint that recives the receives notifications from Digizuite. An important thing to note here is, that the endpoint should be reachable from by the Digizuite server otherwise Digizuite wont . Otherwise, the notifications won't be able to send the notificationssent. This is usually the case for developers on their local environmentenvironments.
let let’s talk about what the controller does when it recives an receives a notification. The data coming from Digizuite will be serilized serialized in to an object of this type:
...
The property ChangeType indicates wheter it is and whether it's an AssetChanged, MetafieldChanged, ComboValueChanged or a TreeValueChanged. If it is 's an AssetChanged we do the following:
Delete blobs for the notified assetidrelevant asset, based on the asset ID.
Delete database entries for the notified assetidthe relevant asset, based on the asset ID.
The last thing we do it , is to raise an episerver Episerver event with the UpdateNotification object.
Code Block | ||
---|---|---|
| ||
_eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId).RaiseAsync( GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeRaiserId, updateNotification, EventRaiseOption.RaiseBroadcast); |
We're also listning listening for the event and for . For AssetChanged we clear the in-memory cache and if the RaiserId is coming from another instance (broadcast) and the configuration “DeleteBlob” is true, then we delete the blobs and database entries for the notified assetidrelevant asset, based on the asset ID.
Code Block |
---|
var digizuiteIntegrationEvent = _eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId); digizuiteIntegrationEvent.Raised += DigizuiteIntegrationEvent_Raised; |
As an a developer, you can also build you your own logic around the notifications from Digizuite, as you can listening . You can listen for the event by register subscribing to the event, just as like we do above.
1. Setup the endpoint
Open the Episerver’s web.config and locate the Digizuite node. The sub node “digizuiteIntegration” Beneath this node, there’s a node called “digizuiteIntegration”. This is the one we should need to update. Here you see an example where it has been configured.:
Code Block | ||
---|---|---|
| ||
<digizuiteIntegration siteUrl="http://my.episerverSite.dk" guid="e01553bd-f66a-4fba-8b6b-884133d8ae80" subscriptions="1" deleteBlob="false"/> |
The siteUrl is the url URL to your episerver Episerver’s site. The guid is used as the unique id, when creating a new endpoint in Digizuite. The default value is empty so you have to generate a new one. The parameter subscription indicates which changetypes you want to listning
In guid, you input the same GUID which is found in the customHeaders field inside Media Manager → General settings → Integrations → Your Episerver integration → Custom headers. In here - the header should be formatting something like this “Authorization:e01553bd-f66a-4fba-8b6b-884133d8ae80“, where the GUID is just a random one you generate. The GUID is used to validate that the notifications come from the correct sender.
The parameter subscriptions indicates which “change type” you want to listen for. The possible values can be found her here DFE 2.01.0 - 3 Setting up Episerver. The default value is 1 which is AssetChanged. - that being the ID of the “AssetChanged” event.
The last parameter deleteBlob indicates whether we should delete the blobs for of the asset or not. In a load balanced invironment environment, where you have multiple instances and in which each of the instances cantains it contains its own local blob storage, then this should be set to true. If the blob storage is share shared between the instances then , leave it as false.
Once the change has been made and you , reload the site, you should . You will now see the following log statment statement in the file Digizuite.log (Of course, this will only appear if Digizuite logging has been enabled):
Code Block |
---|
2020-05-14 08:22:33,529 [1] INFO DigizuiteProviderInit::Initialize: DigizuiteIntegration has been setup and configured |
2. Verify the connection
If Once you have access to the Digizuite server. Open an a browser from that server and access your episerver Episerver site. If you cannot access the site, Digizuite won't be able to send notifications to it.
If the server can access your site, then the next test would be is to change an asset in the Digizuite DAM Center and verify that the notification has been send sent to Episerver.
Change the log level for the logger “Digizuite.Episerver.Helpers.Internal.Logger” to Debug or All.
Reload the site.
Go to Digizuite the DAM Center and find an asset that is published to the Episerver channel and change .
Change some of its the metadata for example, e.g. the title. Now The Digizuite DAM will notify all registret registered integration endpoints with the update.
You should see the following log statment statement in the log file Digizuite.log. This indicates that digizuite Digizuite DAM has delivered the notification to the apicontroller in api controller inside Episerver.
Code Block 2020-05-15 11:20:45,828 [20] DEBUG DigizuiteIntegrationController::Update: DigizuiteIntegration Event, Type:1 ItemId:395810 AssetId:3247
The next thing you can verify is Lastly, verify that the changed metadata that you change is the same as in Episerver.