Showing posts with label SDL Tridion. Show all posts
Showing posts with label SDL Tridion. Show all posts

Wednesday, December 31, 2014

A peek into the Broker database with the Content Delivery Web Service

The Content Delivery (CD) web service, aka OData service, can be used to inspect component presentations or other entities in the Content Delivery broker.

I sometimes see Tridion developers looking into the MS SQL or Oracle database if they want to check what is published. Most Tridion implementations use the CD web service and it is much easier and faster to look into this service. There are exceptions of course, if you want to inspect REL TCDL tags you still want to look into the database, the TCDL tags will get parsed by the Tridion stack when you retrieve content through the CD web service.

Here are a few simple steps to get started browsing though the OData endpoint of the CD web service.


1. Get the Content Delivery web service URL

You can find the URL of the CD web service in the Session Preview settings of the publication targets.


2. Browse the Content Delivery web service

Use Chrome. Firefox and IE try to parse the feed generated by the CD web service and do not show the Atom XML.

Browse to the URL, you will see this listing. Do not forget the tailing / in the URL or you will get the service’s WCF info page instead of the feed. In this example the base URL is http://stg2013sp1demo.ams.dev:84/odata.svc/


This page shows lists all entities available in the Content Delivery web service, ranging from BinaryVariants to Schemas.

3. Digg in into collections

Explore the collections of entities, for example the dynamic component presentations: http://stg2013sp1demo.ams.dev:84/odata.svc/ComponentPresentations


Each component presentation is vieved in a < entry > element. the element contains the full URL to this entry, for example http://stg2013sp1demo.ams.dev:84/odata.svc/ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)

4. Select an entity by id

Grab one specific entity, for example to check it is published correctly:
http://stg2013sp1demo.ams.dev:84/odata.svc/ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123) 
 
The Content Delivery web service is aware of typical CD entities like pages and component presentations, but also the underlying items like schemas and components.

5. Get related entities

The feed is self-explanatory, the nodes show the URLs to dig in deeper into the feed. In the previous example you see the link elements which link to related entities and entity collections.
  • Entity URL
    ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)
  • Component entity for this component presentation
    ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)/Component
  • Component template for this component presentaiton
    ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)/Template
  • Pages where this component presentation is used
    ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)/Pages

 

6. Expand

Entities can be expanded to show more information in one go, for example you can show the full component entity in the component presentation entity.

For example get a component presentation and the linked component:
http://localhost:84/odata.svc/ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)?$expand=Component


Note the < m:inline > element which contains the component entity.


7. Get a field

The OData protocol used for the CD web service also allows to select specific field or field value of an entity. For example the title of the component in the previous example.

http://localhost:84/odata.svc/Components(ItemId=111,PublicationId=6)/title/$value
or
http://localhost:84/odata.svc/ComponentPresentations(PublicationId=6,ComponentId=111,TemplateId=123)/Component/title/$value

 

Sunday, December 28, 2014

Random Weather: an sample ADF cartridge

What better way is there to explain ADF than by an easy to read example: the random Weather Cartridge. The SDL Tridion Ambient Data Framework (ADF) is used for SmartTarget, Experience Manager, and the context engine. Especially for SmartTarget it is common to create your own cartridge. A cartridge can put information about the web visitors context the ADF claim store which in turn can be used in SmartTarget triggers.

This example cartridge puts in a random temperature and weather type. A real cartridge would look up the weather at a third party service, much like the Quova Cartrdige does.

I have put the weather-cartridge project up on GitHub. You can read this to explore ADF, or use it as a basis for your next project. Have look at the readme in the project for more details and build instructions.

The Maven project contains the Jetty plugin and a test webapp to test the cartridge.

Eric Huiza described the ADF mechanism in more detail earlier.

Friday, January 3, 2014

Showing errors in a ECL mountpoint

External Content Library (ECL) Providers can raise error messages in a very user friendly way. The mountpoint can show a list item with the error message when it occurs and error and cannot get data from the external system. This avoids confusing the Tridion CME user with an error message in a popup and having an empty list.


This idea came up in a Tridion.Stackexhange Q&A on http://tridion.stackexchange.com/questions/3097/raising-an-error-from-a-ecl-provider

The solution is implemented in the Flickr ECL provider. See this commit to discover
how this works in more detail.

Basically the Flickr mountpoint will return a error message in a IContentLibraryListItem which represents the error. This ErrorListItem object will have it's own DisplayTypeId so that it can show error icons.

Tridion Core Service in PowerShell

The tridion-powershell-modules project is a PowerShell module written by Peter Kjaer which allows easy access to the Tridion Core Service through PowerShell. Windows PowerShell allows to use the CoreService client DLL and allows to create simple scripts to do Tridion CM maintainance.

This module introduces a number of Powershell commands like Get-TridionClient and Get-TridionUser to interact with the CoreService. Setup for Tridion 2011, 2013 or 2013 SP1 is super easy with the Set-TridionCoreServiceSettings command.

Find the module and the source code in http://code.google.com/p/tridion-powershell-modules/

Earlier I posted a Tridion.Stackexchange answer on how to install and configure the module in Windows Powershell http://tridion.stackexchange.com/a/3643/88

I use a little PowerShell script to remove and install the module when Peter releases a new version https://gist.github.com/jhorsman/7658365


tip #1

Make sure you put the module files in a directory named "Tridion-CoreService". A previous version required a directory names "CoreService" but the module is renamed. If the folder name and module name don't match you will get errors like "Import-Module : The specified module 'CoreService' was not loaded because no valid module file was found in any module".


tip #2

Run Get-Command -Module Tridion-CoreService to learn about the other command in the module.

Monday, December 30, 2013

SmartTarget publishing and synchronization in 5 minutes

This video explains what happens if promotional content is published from SDL Tridion to SmartTarget and how the synchronization of items and promotions in the Smart Target query server works.



http://screencast-o-matic.com/u/VrJp/publishing_smarttarget_promotions

The video was posted a while ago. I decided to make it a bit more findable after getting some positive feedback.