Documentation > Best Practices and Examples > API Solutions

API Solutions

The CrownPeak Application Program Interface (API) Solution lets you use your content dynamically in custom web or mobile applications. You can access the approved content directly through the CrownPeak APIs, or mix and match API access with published content

Overview


CrownPeak’s traditional and primary mode of delivering content is via rendering and publishing files to a target web server on any platform.  This decoupled approach has always allowed customers to publish out data files in formats like XML and JSON to be consumed by web or mobile applications.  This is a great approach for smaller data files or for applications where all of the data is required.  For larger data sets, publishing to a server side database (such as the CrownPeak Database Service) is an option.

The CrownPeak API Solution extends this model to allow direct API access to content and lets you future-proof your content by allowing it to be embedded easily in any web or mobile based application.  Our REST APIs allow you to access your content in real time from any platform.

Uses for the API Solution


CrownPeak’s API Solution has two interfaces:  One is for high speed applications and is redundant, parallel, and fault tolerant.  It is based on the Solr engine and the Search G2 API.  The second API is for managing loading, downloading and managing content and is the called the CMS Access API.

The high speed API is useful for highly dynamic content presentation, personalization etc. where there is a large data set that needs to be queried by the remote web or mobile application for a subset of the full content.  CrownPeak has customers using this approach and can provide demos as requested.  The high speed API returns data in a JSON format natively, and we provide code libraries to make development easier.

The CMS Access API is useful for lower volume applications, for content import/export, and for managing the content from an external application.  This API is rate limited since it uses the native CMS for directly managing the content.

Easy to Setup


Setting up forms for content entry is very quick, and they are beautiful and easy to use.  For API only content delivery, no output HTML formatting is required, making it very easy to get started.  Your content can be managed in any size parts you want, and later assembled into any size component you need.

Input template Example

// Create a check box
Input.ShowCheckBox("", "cp_account", "true", "CrownPeak Account?", unCheckedValue: "false", defaultChecked: false);

// Create a text box
Input.ShowTextBox("CP Account Notes", "cp_account_notes", height: 5, width: 80);

// Create a check box
Input.ShowCheckBox("", "watch_api", "true", "Monitor API?", unCheckedValue: "false", defaultChecked: false);

// Create a text box
Input.ShowTextBox("API Notes", "watch_api_notes", height: 5, width: 80);

// Create a Wysiwyg control
WysiwygParams wParams = ServicesInput.FullWYSIWYG();
wParams.DesignEditTabs = true;
Input.ShowWysiwyg("Intro (Tab 1 Text)", "tab_1_text", wParams, width: 750);

Input.ShowWysiwyg("Bottom Text (Below Screengrabs)", "tab_1_bottom", wParams, width: 750);

You can mix APIs and published content as needed.  You can publish HTML, JSON, XML etc. as files if you want, and/or use the API to access the content.

Easy to Edit Content


The CrownPeak platform that makes it very easy for non-technical users to manage content through inline editing or forms and you can go back and forth between them.  Authors will only have access to content they are permitted to manage, and you can establish as much or as little control as you would like though the admin user interface (i.e. no code required).  As a true SaaS CMS, your teams can manage their content from anywhere in the world through a web browser.  Any kind of file can be uploaded, attached to assets, and be made available to external applications.  In addition our extensive set of connectors allows you to link to video streaming and other services. Figure 1 presents a sample CMS input form that authors would use to edit the content:

 

Figure 1. Sample CMS Input Form

You can use the system for simple forms, or tap into the enterprise level power as needed to do things like computed fields, sophisticated workflow, and user access control for content.  Optionally, you can use CrownPeak’s extensive list of built-in integrations to publish your content to multiple channels at once, like Twitter and Facebook.  Since CrownPeak is a decoupled publishing CMS, you can mix and match your applications to use published content and content via APIs in any way you need.  Output formatting, rendering, and publishing is completely optional.

CrownPeak is the leading SaaS multi-tenant CMS - no software to install or manage.  If you need it, CrownPeak is experienced with meeting the needs of Enterprise IT teams and requirements with certifications like SSAE16 SOC 2, and features like Federated Authentication.  CrownPeak has achieved Safe Harbor for the EU data privacy standard.  You can also manage Multi-lingual content.  CrownPeak is noted for its extensive multi-lingual management capabilities with notification on content changes for derived content.  We can also publish content in many formats at the same time.

Publishing Models


Dynamic Content using Documents Files (Search results stored on hosting servers)

Since you can mix the API and publishing models, it is worth planning your application to be the most efficient.  A few of the possible approaches are publishing data files for small data sets, an API only use, and a mixed publishing/API use.

For small data sets (Figure 2), you may not need the API at all.  You can simply use the CMS to publish the data in your desired format, which can be a custom format, or a standard one like XML or JSON.  Many CrownPeak customers use this approach for JavaScript based dynamic sites, or to supply data to Flash or Mobile apps.  Since all of the data will be typically published in one file, this approach is best suited for smaller data sets or applications where all of the data is required for every use.  It would also be possible to have an index type data file that triggers a second load by the application.  In the below diagram, the greyed out parts are not necessary, so the configuration is clearly very easy to set up.

Figure 2. Classic Publishing Model

For large data sets and dynamic use of the data (Figure 3), the API only approach may make the most sense.  In this case, the data is only consumed via the API, with either the high speed API, or the CMS Web Access API.

Figure 3. API Only Publishing Model

Of course, you can mix these approaches as your application needs (Figure 4).  If there are static data or HTML components to your application, you can publish those while using the APIs for the dynamic portions of the application.

Figure 4. Mixed Publishing Model

Content Delivery Network (CDN)


CrownPeak offers a powerful CDN to allow your binary content to be served from the edges of the Internet for faster speeds for end users.  To use the CDN, we will configure your CMS to publish the binary assets and template files to a host that will be read by the Amazon CloudFront CDN.  The URLs for those resources will use the CDN URIs, and end users will get the closest asset when they are using your application.  CrownPeak has several customers using the CDN for faster response times, and we can provide demonstrations upon request.

High Speed Delivery API

The High Speed Delivery API allows you to support real time transactions.  You can query for content via the REST API, and the results are presented in easy to consume JSON format.  This system is based on the CrownPeak Search G2 engine, and is highly redundant and parallel.  For this approach, we publish the content out as meta data fields in documents and the search indexer will read that fielded data  and store in in a high speed retrieval system.  From your application, you then query the data and the results are returned in native JSON format.  We provide SDKs for easier development in JavaScript and .Net/C#.

 The current version of the JavaScript SDK can be found here:

  • http://searchg2-assets.crownpeak.net/crownpeak.searchg2-0.2.0.js
  • http://searchg2-assets.crownpeak.net/crownpeak.searchg2-0.2.0.min.js

The C# SDK and additional documentation are available upon request. Some example applications are at the below locations.  These are web applications that present a more search oriented result, but of course, you can use the same data in any type of application.  Note the advanced features such as Geospatial searching.

A simple text searchhttp://stagetraining2.cp-access.com/searchg2/javascript-sdk-showcase

A Geospatial search using Google Mapshttp://stagetraining2.cp-access.com/searchg2/javascript-sdk-showcase/geo.aspx

The CrownPeak cheese shop, showing multiple facetinghttp://stagetraining2.cp-access.com/searchg2/javascript-sdk-showcase/cheese.aspx

Web Access API

The CrownPeak Web Access API allows you to add and manage content in the CMS.  It also allows you to extract content in lower load situations, such as making backups, or moving content to other systems on an infrequent basis.

There are several SDKs (C# PCL, PowerShell, C# Server Side, and node.js) available to get you started quickly.  These can be found at http://developer.crownpeak.com/Documentation/BestPractices/AccessAPI/AccessAPI.html.

The Web Access API is documented at http://developer.crownpeak.com/Documentation/AccessAPI/index.html

AssetController Example

The Asset web API function calls are used to manage assets in the CMS. These calls allow external programs to create, update, and delete assets using the POST, PUT, and DELETE calls. 

# Name Description
1 accessapi/Asset/Attach Upload and attach data to an asset. Attachment name will be based on originalFilename parameter and saved to the content fields of the asset.
2 accessapi/Asset/Branch/{id} Creates a branch from the specified asset. The asset created as a result is returned.
3 accessapi/Asset/Create Create a new asset.
4 accessapi/Asset/Delete/{id} Marks the specified asset as deleted. Deleted assets are permanently removed from the CMS after 15 days.
5 accessapi/Asset/ExecuteWorkflowCommand   Move an asset through its workflow.
6 accessapi/Asset/Exists Determine is an Asset exists.

The complete list of function calls can be found at: http://developer.crownpeak.com/Documentation/AccessAPI/AssetController/index.html

Connect with Crownpeak