db#

API for getting and replacing the app Database.

Get DB#

Get the complete DB content.

  • URL: /api/db
  • Method: GET
  • URL Params:
  • dataonly=[0 or 1], default is 0, optional

Success Response#

  • Code: 200 OK
  • Content:
    {
      "data": "<_DB DATA_>",
      "edition": "full",
      "ts": 1578589264472,
      "version": "v1.2.0"
    }
    

Sample Call#

curl --request GET \
  --url 'http://localhost:3000/api/db'

Sample Call for getting data only#

curl --request GET \
  --url 'http://localhost:3000/api/db?dataonly=1'

Replace DB#

Replace the complete DB content.

  • URL: /api/db
  • Method: PUT
  • Body Props:
    {
      "data": "<DB_DATA>",
      "edition": "<EDITION>",
      "keepPaths": "[boolean, default true]",
      "ts": "<TS>",
      "version": "<VERSION>"
    }
    

Success Response#

  • Code: 200 OK
  • Content:
    {
      "status": "OK"
    }
    

Error Response example#

  • Condition: If provided data is invalid, e.g. edition does not exist.
  • Code: 400 BAD REQUEST
  • Content:
    {
      "errors": [
        {
          "keyword": "required",
          "dataPath": ".data",
          "schemaPath": "#/required",
          "params": {
            "missingProperty": "edition"
          },
          "message": "should have required property 'edition'",
          "schema": {
            "current": {
              "$ref": "current.json#/"
            },
            "edition": {
              "$ref": "defs.json#/definitions/edition"
            },
            "globalParams": {
              "$ref": "params.json#/"
            },
            "plugins": {
              "items": {
                "properties": {
                  "deactivated": {
                    "$ref": "defs.json#/definitions/deactivated"
                  },
                  "globalSettings": {
                    "type": "object"
                  },
                  "id": {
                    "$ref": "defs.json#/definitions/id"
                  },
                  "version": {
                    "$ref": "defs.json#/definitions/version"
                  }
                },
                "required": ["deactivated", "globalSettings", "id", "version"],
                "type": "object"
              },
              "type": "array"
            },
            "settings": {
              "$ref": "settings.json#/"
            },
            "sync": {
              "$ref": "sync.json#/"
            },
            "version": {
              "$ref": "defs.json#/definitions/version"
            },
            "views": {
              "items": {
                "properties": {
                  "added": {
                    "$ref": "defs.json#/definitions/ts"
                  },
                  "data": {
                    "$ref": "view.json#/"
                  },
                  "edited": {
                    "$ref": "defs.json#/definitions/ts"
                  },
                  "id": {
                    "$ref": "defs.json#/definitions/id"
                  }
                },
                "type": "object"
              },
              "type": "array"
            }
          },
          "parentSchema": {
            "$id": "http://treetop.de/disco/schemas/db.json",
            "additionalProperites": "false",
            "description": "Database Schema",
            "properties": {
              "current": {
                "$ref": "current.json#/"
              },
              "edition": {
                "$ref": "defs.json#/definitions/edition"
              },
              "globalParams": {
                "$ref": "params.json#/"
              },
              "plugins": {
                "items": {
                  "properties": {
                    "deactivated": {
                      "$ref": "defs.json#/definitions/deactivated"
                    },
                    "globalSettings": {
                      "type": "object"
                    },
                    "id": {
                      "$ref": "defs.json#/definitions/id"
                    },
                    "version": {
                      "$ref": "defs.json#/definitions/version"
                    }
                  },
                  "required": ["deactivated", "globalSettings", "id", "version"],
                  "type": "object"
                },
                "type": "array"
              },
              "settings": {
                "$ref": "settings.json#/"
              },
              "sync": {
                "$ref": "sync.json#/"
              },
              "version": {
                "$ref": "defs.json#/definitions/version"
              },
              "views": {
                "items": {
                  "properties": {
                    "added": {
                      "$ref": "defs.json#/definitions/ts"
                    },
                    "data": {
                      "$ref": "view.json#/"
                    },
                    "edited": {
                      "$ref": "defs.json#/definitions/ts"
                    },
                    "id": {
                      "$ref": "defs.json#/definitions/id"
                    }
                  },
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "current",
              "edition",
              "plugins",
              "settings",
              "sync",
              "version",
              "views"
            ],
            "title": "Database",
            "type": "object"
          },
          "data": {
            "settings": {
              "app": {
                "infos": {
                  "fontSize": 16
                },
                "logs": {
                  "enabled": true,
                  "level": "debug",
                  "path": "/Users/bo/treetop/gitlab/disco/disco/WORK/logs"
                },
                "ports": {
                  "http": 3000,
                  "https": 3443
                },
                "window": {
                  "frame": true
                },
                "httpApiProxy": {
                  "allowedIps": []
                },
                "publicAssets": {
                  "enabled": false,
                  "path": "/Users/bo/treetop/gitlab/disco/disco/WORK/public"
                }
              },
              "website": {
                "infosIv": 20,
                "tz": "Europe/Berlin"
              }
            },
            "sync": {
              "follow": {
                "activated": false
              }
            },
            "version": "v1.2.0",
            "globalParams": [
              {
                "id": "WNEDzeyC",
                "isGlobal": true,
                "label": "param_0",
                "props": {
                  "defaultIndex": 0,
                  "items": []
                },
                "type": "Selector",
                "access": "rw"
              }
            ],
            "plugins": [
              {
                "globalSettings": {
                  "devices": [],
                  "reconnectTimeout": 10
                },
                "deactivated": false,
                "id": "EmBERplus_Consumer",
                "version": "0.0.7"
              },
              {
                "globalSettings": {
                  "port": 9000,
                  "useGlobalOnly": false
                },
                "deactivated": false,
                "id": "EmBERplus_Provider",
                "version": "1.1.0"
              }
            ],
            "current": {
              "id": "DEMO_0",
              "mode": "PUT"
            },
            "views": [
              {
                "added": 1576499018383,
                "edited": 0,
                "data": {
                  "grid": {
                    "cols": 16,
                    "rowHeight": 36
                  },
                  "label": "DEMO Button",
                  "layout": [
                    {
                      "h": 7,
                      "i": "gCBjao-g9",
                      "w": 4,
                      "x": 1,
                      "y": 2
                    }
                  ],
                  "params": [
                    {
                      "id": "BOOLEAN_0",
                      "label": "boolean_0",
                      "props": {
                        "defaultVal": false
                      },
                      "type": "Boolean",
                      "access": "rw"
                    }
                  ],
                  "styles": {
                    "backgroundColor": "#212121",
                    "backgroundImage": "none",
                    "color": "#e0e0e0",
                    "fontFamily": "OpenSans",
                    "fontSize": 24,
                    "fontStyle": "inherit",
                    "fontWeight": 400
                  },
                  "widgets": [
                    {
                      "conditionalStyles": [],
                      "styles": {
                        "& .widget__Button__inner": {
                          "alignItems": "center",
                          "backgroundColor": "#42a5f5",
                          "backgroundImage": "none",
                          "borderColor": "#1976d2",
                          "borderRadius": "4",
                          "borderStyle": "solid",
                          "borderWidth": "2",
                          "color": "#ffffff",
                          "cursor": "pointer",
                          "fontFamily": "inherit",
                          "fontSize": "inherit",
                          "fontStyle": "inherit",
                          "fontWeight": "inherit",
                          "justifyContent": "center",
                          "lineHeight": "1.0",
                          "opacity": 1,
                          "padding": "8px",
                          "visibility": "visible"
                        },
                        "& .widget__Button__inner:active": {
                          "opacity": 0.75
                        },
                        "& .widget__Button__inner:disabled": {
                          "cursor": "not-allowed",
                          "opacity": 0.5
                        },
                        "& .widget__Button__inner:hover": {
                          "backgroundColor": "#1e88e5"
                        },
                        "padding": "0"
                      },
                      "wProps": {
                        "actions": [
                          {
                            "id": "BOOLEAN_0",
                            "type": "BOOLEAN_TOGGLE"
                          }
                        ],
                        "disabling": {
                          "source": "Static",
                          "val": false
                        },
                        "label": {
                          "falseReplacer": "false",
                          "format": "HH:mm:ss",
                          "source": "Parameter",
                          "text": "NO LABEL",
                          "locale": "de",
                          "trueReplacer": "true",
                          "tz": "Europe/Berlin",
                          "labelParam": "BOOLEAN_0"
                        }
                      },
                      "id": "gCBjao-g9",
                      "label": "Button_0",
                      "wType": "Button"
                    }
                  ],
                  "win": {
                    "alwaysOnTop": false,
                    "fullscreen": false,
                    "kiosk": false,
                    "height": 768,
                    "width": 638,
                    "x": 0,
                    "y": 0
                  }
                },
                "id": "DEMO_4"
              }
            ]
          }
        }
      ],
      "edition": "full",
      "ts": 1578589953080,
      "version": "v1.2.0"
    }
    

Sample Call#

curl --request PUT \
  --url http://localhost:3000/api/db \
  --header 'content-type: application/json' \
  --data '{
  "data": {
        "edition": "full",
        "settings": {
            "app": {
                "infos": {
                    "fontSize": 16
                },
                "logs": {
                    "enabled": true,
                    "level": "debug",
                    "path": "/Users/bo/treetop/gitlab/disco/disco/WORK/logs"
                },
                "ports": {
                    "http": 3000,
                    "https": 3443
                },
                "window": {
                    "frame": true
                },
                "httpApiProxy": {
                    "allowedIps": []
                },
                "publicAssets": {
                    "enabled": false,
                    "path": "/Users/bo/treetop/gitlab/disco/disco/WORK/public"
                }
            },
            "website": {
                "infosIv": 20,
                "tz": "Europe/Berlin"
            }
        },
        "sync": {
            "follow": {
                "activated": false
            }
        },
        "version": "v1.2.0",
        "globalParams": [
            {
                "id": "WNEDzeyC",
                "isGlobal": true,
                "label": "param_0",
                "props": {
                    "defaultIndex": 0,
                    "items": []
                },
                "type": "Selector",
                "access": "rw"
            }
        ],
        "plugins": [
            {
                "globalSettings": {
                    "devices": [],
                    "reconnectTimeout": 10
                },
                "deactivated": false,
                "id": "EmBERplus_Consumer",
                "version": "0.0.7"
            },
            {
                "globalSettings": {
                    "port": 9000,
                    "useGlobalOnly": false
                },
                "deactivated": false,
                "id": "EmBERplus_Provider",
                "version": "1.1.0"
            }
        ],
        "current": {
            "id": "DEMO_0",
            "mode": "PUT"
        },
        "views": [
            {
                "added": 1576499018383,
                "edited": 0,
                "data": {
                    "grid": {
                        "cols": 16,
                        "rowHeight": 36
                    },
                    "label": "DEMO Button",
                    "layout": [
                        {
                            "h": 7,
                            "i": "gCBjao-g9",
                            "w": 4,
                            "x": 1,
                            "y": 2
                        }
                    ],
                    "params": [
                        {
                            "id": "BOOLEAN_0",
                            "label": "boolean_0",
                            "props": {
                                "defaultVal": false
                            },
                            "type": "Boolean",
                            "access": "rw"
                        }
                    ],
                    "styles": {
                        "backgroundColor": "#212121",
                        "backgroundImage": "none",
                        "color": "#e0e0e0",
                        "fontFamily": "OpenSans",
                        "fontSize": 24,
                        "fontStyle": "inherit",
                        "fontWeight": 400
                    },
                    "widgets": [
                        {
                            "conditionalStyles": [],
                            "styles": {
                                "& .widget__Button__inner": {
                                    "alignItems": "center",
                                    "backgroundColor": "#42a5f5",
                                    "backgroundImage": "none",
                                    "borderColor": "#1976d2",
                                    "borderRadius": "4",
                                    "borderStyle": "solid",
                                    "borderWidth": "2",
                                    "color": "#ffffff",
                                    "cursor": "pointer",
                                    "fontFamily": "inherit",
                                    "fontSize": "inherit",
                                    "fontStyle": "inherit",
                                    "fontWeight": "inherit",
                                    "justifyContent": "center",
                                    "lineHeight": "1.0",
                                    "opacity": 1,
                                    "padding": "8px",
                                    "visibility": "visible"
                                },
                                "& .widget__Button__inner:active": {
                                    "opacity": 0.75
                                },
                                "& .widget__Button__inner:disabled": {
                                    "cursor": "not-allowed",
                                    "opacity": 0.5
                                },
                                "& .widget__Button__inner:hover": {
                                    "backgroundColor": "#1e88e5"
                                },
                                "padding": "0"
                            },
                            "wProps": {
                                "actions": [
                                    {
                                        "id": "BOOLEAN_0",
                                        "type": "BOOLEAN_TOGGLE"
                                    }
                                ],
                                "disabling": {
                                    "source": "Static",
                                    "val": false
                                },
                                "label": {
                                    "falseReplacer": "false",
                                    "format": "HH:mm:ss",
                                    "source": "Parameter",
                                    "text": "NO LABEL",
                                    "locale": "de",
                                    "trueReplacer": "true",
                                    "tz": "Europe/Berlin",
                                    "labelParam": "BOOLEAN_0"
                                }
                            },
                            "id": "gCBjao-g9",
                            "label": "Button_0",
                            "wType": "Button"
                        }
                    ],
                    "win": {
                        "alwaysOnTop": false,
                        "fullscreen": false,
                        "kiosk": false,
                        "height": 768,
                        "width": 638,
                        "x": 0,
                        "y": 0
                    }
                },
                "id": "DEMO_4"
            }
        ]
    },
    "keepPaths": true,
  "edition": "full",
  "ts": 1575385829678,
  "version": "v1.2.0"
}'

Last update: March 10, 2020