Local blocks and Content Delivery API

Vote:
 

Hi,

I noticed that my properties that are local blocks are not visible in the JSON that I get in return from a reqeust to the Content Delivery API.

Is there any way to include properties from local blocks in a request to "/api/episerver/v2.0/content/{referenceORguid}"?

I've been looking at making my own PropertyModel but I'm not sure how I can get it to apply to a local block. Anyone have any ideas or input?

/Niklas

#202488
Mar 27, 2019 12:54
Vote:
 

Hi Niklas,

You should create a new property model converter for your custom property.

Checkout this document for more details.

#202632
Mar 28, 2019 7:48
Vote:
 

Hi Quan,

Thanks for your reply!

I've been looking at making my own property model but as I said, I'm not sure how I can get it to apply to a local block.

If I create a new class that inherits from PropertyModel<TValue,TType> , what should i put as TType? It must be a type that is a type of PropertyData, and what type of PropertyData is a local block?

Do you have any example of this? I can't get it to work.

#202697
Mar 29, 2019 9:14
Vote:
 

Hi Niklas,

Can you show me the code of your custom property and its usage ?

#202720
Mar 29, 2019 11:12
Vote:
 

Hi Quan,

I don't have any code to show you since I don't know what to put as TType for a local block.

/Niklas

#202721
Mar 29, 2019 11:14
Vote:
 

Hi Niklas,

You can put PropertyBlock as TType.  

You can take a look at the music festival template site to see the real scenario on how to create custom block and implement property model.

  1. Create a custom block. here
  2. Create property model for custom block. here
  3. Create property model converter here
  4. Display its value on UI here 
#202764
Apr 01, 2019 3:58
Vote:
 

Hey,

Thanks for your reply! I will try this.

#202790
Apr 01, 2019 16:00
Vote:
 

Hi Niklas,

If it works, please mark as Resolve :)

#202823
Apr 02, 2019 8:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.