3 steps to connecting Adobe InDesign and Kirby.
Step 1: Install Kirby
Kirby is a flat-file CMS. That means all content is stored in files and folders. You can create that files and folders manually in the file system (and edit content files with the text editor). But it’s also possible to use a panel for that or create and modify content programmatically – with Kirby’s API.
Kirby has an extremely flexible and versatile panel for data input.
The individual layout and field definitions are done in blueprints with YAML. Many predefined field types are already included. Custom fields can also be created.
So you have full control over input fields and output format: »Content Representations allow you to output the content in different formats. Be it JSON for your frontend JS library of choice or to use Kirby as an API for other tools, […]«. And this is where InDesign comes in …
You can download Kirby via https://getkirby.com/ (One license currently costs 99 Euro.)
Step 2: Configure Kirby
To connect to InDesign, Kirby 3 has a built in REST API: »It offers full access to your site, pages, files, users and more.« Every API request requires authentication. Kirby offer session-based authentication or HTTP Basic auth.
»Basic auth« has to be activated in the configuration file:
<?php return [ 'api' => [ 'basicAuth' => true ] ];
When »Basic auth« is activated, you must send an authorization header with every request.
Step: Fetch data in InDesign
Via doScript and for example cURL the data can be fetched from Kirby in InDesign. Here is an example:
cURL command for API data:
var _curlCommand = "curl -X GET 'https://www.rolanddreger.net /apollo/api/pages/list/children?select=id,num,title,url,content' -u yourUserName:yourPasswort -H 'Host: www.rolanddreger.net'";
Page ID: list
URL for the XML file:
In this example, an XML representation of all article pages (children of list page) will be created and imported into InDesign.
var _apiRequestString = app.doScript('do shell script "' + _curlCommand + '"', ScriptLanguage.APPLESCRIPT_LANGUAGE);