Content API

Build a Windows Desktop Application that Connects to Liquid Content

George Alatrash

Developers who write applications targeting DNN’s Liquid Content service need a simple way to validate access to their data. The Liquid Content Explorer aims to simplify this and let developers navigate various Liquid Content types and content items--and view their various sub elements in a Windows Explorer tree-like viewport.

The demo code is based on Windows Forms desktop application that can be loaded and compiled with Visual Studio 2015 or higher with .NET Framework 4.5.2 or higher. The application uses Windows forms to read and display the content structure types and items. When loading the application in Visual Studio you should see a window like this one.

Picture1.png


The solution is composed of two projects:

  1. Windows Form project LiquidContentExplorer which contains the views and UI
  2. The Structured-Content Models project StructuredContent.Models which contains the .NET classes representing the entities stored in SC

The values for the text boxes (A) and (B) are filled with values obtained from the "App.config" file:

Picture2.png

When running the application, you will see a window like this (without any data at first).

Picture3.png


After clicking the Load Content (if the values in A and B are valid), the application will perform the following three tasks:

  1. Request the API version from the service and display it in the API "Version text" box.
  2. Send a request to the service to GET the added content types and display them in the tree pane.
  3. Send a request to the service to GET the added content data records and display them in the tree pane.

Picture4.png

Picture5.png

Note: when de-serializing the content types in Step 2 above, you need to use a typed conversion de-serializer for this to work with all the defined structured content types. The models project contains the necessary converter to be used. Here is an example:


The sample code contains a *token* that has read-only permission for the data. To be able to insert/update/delete any content, you need to obtain a token with a "write" permission.

Picture6.png

As you can see, it’s actaully quite easy to build an application to consume data from Evoq Liquid Content.