Skip to content

Use Dynamic Tables (API based) on Livingsdocs

nickeichmann edited this page Jun 18, 2024 · 1 revision

This guide will give you instructions on how to use the Dynamic Tables (API based) function in Livingsdocs with data stored on LINDAS.

Preparing data on LINDAS

Find the dataset you need and open the specific query in the YASGUI Query Editor. When the result is displayed correctly, click on the share icon in the top right corner and select the "curl" option. Copy the text that appears.

manual_prepare_LINDAS_data

Prepare API-URL

The copied text from the previous step has the following format: curl https://lindas.admin.ch/query --data query=SELECT%20%3Fdimension0 ... 3Fdimension3%29%0A%7D -X POST

Delete the first part up to query= and the last part starting (with the whitespace) -X POST. So you just have the URL with a format like: SELECT%20%3Fdimension0 ... 3Fdimension3%29%0A%7D.

Add at the text https://lindas.admin.ch/query?format=csv&query= to the beginning of the URL. Depending on the data source add the specific URL:

  • PROD: https://lindas.admin.ch/query?format=csv&query=
  • INT: https://int.lindas.admin.ch/query?format=csv&query=
  • TEST: https://test.lindas.admin.ch/query?format=csv&query=

Save this new URL.

Working with Livingdocs

Add a new Dynamic Tables (API based) container to your content page. Fill in the following fields with the described content.

Form_Livingdocs_Dynamic_Table
  • API Endpoint URL: Add the previously created URL
  • File Type: Select CSV
  • Nested element: Not required
  • Table Schema: For each desired column you must add a description with the schema: {"title":"YourDesiredTitle", "field":"NameOfTheDimensionOfTheDataset"}, {"title":"AnotherTitle", "field":"ForExampleDimension2"} Further you can also add formatting rules. You can find some inspiration here: https://tabulator.info/docs/6.2/format.
  • The last three options are technically not necessary.