1

Is there a way to return the raw content of a component minus its presentation using an out of the box (DXA or CMS/CDS) capability? Preferably, no additional (back end or server-side) development would be required.

I also understand that you can append the querystring variable, "format=json", at the end of a request but it only returns the data model and not the content itself.

3
  • 1
    Can you clarify what you mean with "the raw content of a component minus its presentation" and with "it only returns the data model and not the content itself" ? Doesn't the Data Model contain the content itself? Commented Apr 5, 2017 at 17:20
  • @RickPannekoek - Just the content in a component. When I inspect the JSON that gets returned in the data model, there is some content. However, the large majority contain attributes like ComponentID, ComponentTemplateID, their respective TCM IDs and not the actual content itself.
    – Keefu
    Commented Apr 6, 2017 at 12:49
  • The idea with DXA is that you map the content/metadata fields of a Component to properties of a View Model. If you do a request with ?format=json, you get a JSON representation of the View Model which contains the mapped content/metadata and some additional system metadata. If you just want the raw content of a Component (Presentation), you should use the Content Service. Commented Apr 6, 2017 at 16:58

2 Answers 2

2

DXA is a web Application, so component presentations are rendered as output and it serves the desired purpose. But, what you are looking for is a sort of Rest API which responds with content data.

You can achieve using either of the following options,

  1. You can use the oData webservice available with Tridion 2013 to query explicitly for the component content. Example - http://tridion.sdldemo.com:8081/odata.svc/Components(ItemId=3768,PublicationId=67)
  2. Download and use the NuGet package DD4T Rest API in the DXA web App
  3. Implement a custom Model builder and register it in the DXA webApp where you have full access to component content, so you can expose only the component content for your needs.

Hope this helps

2
  • Yes, a RESTful API is exactly what I am looking for. I didn't know if it was a function of DXA or the CDS. Option #1 is attractive. Is this something that would need to be setup and configured or is it something available as part of the Tridion setup?
    – Keefu
    Commented Apr 5, 2017 at 14:35
  • 1
    The content service (OData) is rather simple to configure, but not standard in 2013, you need to deploy it either as a .NET web app or Java. In 8+ all the micro service architecture is based on this (or a variant/evolution of it rather)
    – Nuno Linhares
    Commented Apr 5, 2017 at 22:01
0

If I understand your question correctly, you are trying to render the content of a component presentation. No OOTB APIs are available, to my knowledge. You can write a custom controller to which you need to parse the component ID and the component presentation ID to produce the output as a string.

You can take a look at the below answer by Rick for rendering a dynamic component presentation as a string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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