This document is intended for administrators that have access to the "databrowser.ini" configuration file.

It describes a low-level API for uploading databrowser configuration files.

Configuration file API

The databrowser has an api that the end-user can use to upload a new "databrowser.ini" file to the "/sesam/data" folder. Settings in this file will override the values in the "/sesam/conf/databrowser.ini" file. This API is exposed in the end-user GUI.

In some cases an additional layer of uploadable configfiles is required in order to inject configuration that the end-user isn't supposed to be directly exposed to. For this purpose we have an API endpoint that is not exposed in the end-user GUI.

These additional configuration files are stored in a folder-structure like this:

"/sesam/data/conf/1/databrowser.ini"
"/sesam/data/conf/2/databrowser.ini"
"/sesam/data/conf/3/databrowser.ini"

The numeric part of the filepath specifies the order in which the configuration-files will be processed.

Configuration files in higher-value folders can override settings from configfiles in lower-value config-folders. Example: configuration files in the "/sesam/data/conf/2"-folder will override configuration files in the "/sesam/data/conf/1" folder.

The config-files in the "/sesam/data" folder itself will be processed last, so that the config-files uploaded by the end-user can override settings from any of the "/sesam/data/conf/<config_layer_sortorder>" folders.

The api endpoint for GET/PUT/DELETE-ing the "end-user" databrowser.ini is:

"/configuration/databrowser.ini".

The endpoint for getting/uploading/deleting the "layered" config-files is:

"/configuration/<confignumber>/databrowser.ini".

Examples:

"/configuration/1/databrowser.ini"
"/configuration/2/databrowser.ini"
"/configuration/3/databrowser.ini"

Authorization

In order to use the configuration file api, the http request must contain a JWT token in the "Authorization" request header.

The databrowser must therefore have been configured to support JWT-authentication.

The JWT must grant the "Admin" role.

Example

Below is an example of how to upload and downlad a layers configuration file (the JWT token that is used to set the "AUTH_HEADER" variable must be generated by the Sesam Portal for the subscription that the databrowser has been configured with):

AUTH_HEADER="Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE1MTY2MTEzNzUuNTI5Nzc5MiwiZXhwIjoxNTE2Njk3Nzc1LjUyOTc3MzcsInVzZXJfaWQiOiJzZXNhbS1wb3J0YWwiLCJ1c2VyX3Byb2ZpbGUiOnsiZW1haWwiOiJhZG1pbkBleGFtcGxlLmNvbSIsIm5hbWUiOiJhZG1pbkBleGFtcGxlLmNvbSIsInBpY3R1cmUiOiIifSwidXNlcl9wcmluY2lwYWwiOiJlbWFpbDphZG1pbkBleGFtcGxlLmNvbSIsInByaW5jaXBhbHMiOnsiMTIzNDUiOlsiZ3JvdXA6QWRtaW4iXX19.aMCJBdxwPXsW74EFjqRy94sSdgeyAW80t7J0GyPCrQHDhR7RZVZ3rKOz6G2_Ry8jWsTL_UODcPJWjYfE7RKIj7JCKKWOXCsRKdFM_pHizR7_9f5Zsb_pWv6diXbgOgC_NdMcswBn3PGWs75IVf-kGtcJvzdo3w3MxmHjoD9wrCFJccZlLIqYT9MHuKen8K6nqs8AYjjNnKnSbh1XlnyacTFZhaP8_QK-zl_jGQ3tzMoye8ec6AArED7C20NO-sYfw9klqowC2tuiCa1W0U8xRss-OyqTHkZN04MvFeZ-OcInqigPMaimQRhMOqAokyS6VKQ7uwaw198dJMblOn5xwg"

echo "# Just testing layer 1." > databrowser_for_layer_1.ini

curl -H "$AUTH_HEADER" -X PUT -d @databrowser_for_layer_1.ini http://localhost:6543/configuration/conf/1/databrowser.ini

curl -H "$AUTH_HEADER" http://localhost:6543/configuration/conf/1/databrowser.ini