November Happy Hour will be moved to Thursday December 5th.

CMS 12 + Content Delivery API 3.0.0

Vote:
 

Hi

I'm trying to implement ContentModelMapper in Content Delivery API 3.0.0 in a cms 12 site.

"Working with ContentModelMapper"
https://world.optimizely.com/documentation/developer-guides/content-delivery-api/getting-started/serialization/#ContentModelMapper

I don't see any support for this yet.
Has it been replaced or is in a future release?

Missing interfaces
IContentModelMapper
IPropertyModelConverter

#266935
Nov 18, 2021 13:12
Vote:
 

As the Content Delivery API was only just released in the last week for CMS 12 the documentation may not have been updated. I imaging there will be some changes so you'd have expected a version 3 of this page. I'd submit feedback on the page asking

#266942
Nov 18, 2021 15:41
Vote:
 

You can use IContentConverterProvider

#266977
Nov 18, 2021 17:56
Vote:
 

Ok, thanks.
Will it be updates in the documentation soon how to do this?

I'm trying to implement the solution from
https://github.com/vsolheim/Demo-ModelConverters-Epi-ContentApi
in CMS 12 - Content Delivery API v3

#267177
Nov 22, 2021 10:27
Vote:
 

@paul Wiren: we would provide a sample in details for this. Quite busy now with new milestone and several SCs. I would start this the next week.. So sorry for any delay.

For quick info, you can create a new provider inheriting IPropertyConverterProvider, and SortOrder should be larger than 0. Then within Resolve function, just need to return IPropertyCOnverter for your special propertydata 

Example

     public IPropertyConverter Resolve(PropertyData propertyData)
        {
            if (propertyData == your_propertyData)
            {
                return yourPropertyConverter;
            }
            return null
        }

We use Provider Pattern so that if your provider has higher order, it would be called to handle the request, and if it returns null, other providers (our default provider) is still activated.

Sorry if short answer :)

#267278
Nov 24, 2021 4:14
Vote:
 

Hi! 

Jumping in late in this thread. I have difficulties finding information/documention about how to rewrite an existing solution using the interfaces:

IContentModelMapper
IPropertyModelConverter

This is based on the musicfestival template code found here that is still referenced in the current content delivery api documentation.

Could anyone point me on the right direction?

Thanks in advance! 

#269361
Jan 03, 2022 16:51
Vote:
 

Implement interface IPropertyConverterProvider like

YourPropertyConvertorProvider : IPropertyConverterProvider

{

// in method

IPropertyConverter Resolve(PropertyData propertyData){

//check propertyData type - if it matches then returns YourPropertyConvertor

}

}

YourPropertyConvertor should implement IPropertyConverter which has a single method 'Convert' - then from convert return PropertyModel as you woiuld do in cms 11.

Hope that helps.

#269420
Jan 04, 2022 16:22
Vote:
 

Perfect, works like a charm! 

Thanks!

#269467
Jan 05, 2022 11:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.