1

We have articles that are published on pages. For one article we want to call the Entity from the broker database (on cd server). It is not DCP? I dn't know.

Code from MVC Controller (it's a REST API thats called from frontend).

            var localization = new Sdl.Web.Common.Configuration.Localization()
            {
                Language = "Nederlands",
                Id = "102",   // publication id of the website
            };

            var provider = new Sdl.Web.Tridion.Mapping.GraphQLContentProvider();

            // Use the Component tcm - component template tcm
            EntityModel entityModel = provider.GetEntityModel("418926-418875", localization);   
            

this results in Exception:

{"Item '418926-418875' not found"} at Sdl.Web.Tridion.Mapping.DefaultContentProvider.LoadEntityModel(String id, Localization localization)\r\n
at Sdl.Web.Tridion.Mapping.DefaultContentProvider.<>c__DisplayClass3_1.b__0()\r\n
at Sdl.Web.Tridion.Caching.CacheProvider.CreateCacheValue[T](UInt32 hash, String key, String region, Func1 addFunction, IEnumerable1 dependencies)\r\n
at Sdl.Web.Tridion.Caching.CacheProvider.GetOrAdd[T](String key, String region, Func1 addFunction, IEnumerable1 dependencies)\r\n
at Sdl.Web.Tridion.Mapping.DefaultContentProvider.GetEntityModel(String id, Localization localization)\r\n
at Uwv.eDv.Web.Modules.Core.Controllers.CustomOverzichtApiController.Post(OverzichtInput input) in D:\..\Controllers\CustomOverzichtApiController.cs:line 60"

Questions.

  1. Is this DCP? If not how can be get it's information without being DCP.
  2. Is there other way to get Entitymodel from broker database. Sample?

Update-1: Changed CT to DCP, but still not works. enter image description here

1

To access the DCP components from the broker using the Graphql DXA entity model - components should be published to the broker.

At least from sites 9.5, it's possible by data template less publishing to get that data from broker using Graphql.

I don't see any other option to fetch this information without publishing it as DCP.

3
  • I made new DCP for this component, and used that on the page. The CT only chage i made in it is changed to "Component Presentations based on this Component Template will be:" Publish as a Dynamic Component". tested both check/uncheck for "Allow on Page Using Dynamic Assembly". When excute "provider.GetEntityModel .." with this it thorws Exception: {"PCA client returned an unexpected response when retrieving enity model data for id 418926-419027."} Is more needed? Sep 15 at 17:00
  • With DCP Exception: {"PCA client returned an unexpected response when retrieving entity model data for id 418926-419027."} Exception while fetching data (/componentPresentation/rawContent) : Error occurred while transforming component presentation content at Line : 5 Column :4\r\n"} Why? Sep 15 at 17:20
  • Maybe site 9 has also this. gateway.sdl.com/CommunityKnowledge?articleName=000013754 Sep 16 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.