Link Search Menu Expand Document

Import Data from Microapp

Buzzy provides a method for transferring data from one Microapp to another by using Import data from URL. A good understanding of the Buzzy REST API is helpful.

Steps

  1. If required, schedule a maintenance period to transfer the data.
  2. Stop all the traffic to the source Microapp
  3. Create a empty Microapp (Application) for the destination
  4. Select the Properties, Advanced, Data Source, URL Import.
  5. Enter the JSONata script
  6. Preview the results and make any required changes
  7. Select Import
  8. Validate the counts for insert and upsert in the message window

Example JSONata import script

{
  "variables": {
    "host": "https://ssc.preciselydemos.com"
  },
  "secrets": {
    "username": "",
    "password": ""
  },
  "source": {
    "description": "Get data from Buzzy",
    "type": "url",
    "config": {
      "resultObject": "content",
      "url": "https://ssc.preciselydemos.com/api/microappdata",
      "method": "POST",
      "paging": {
        "param": "skip",
        "data": [
          "searchFilter",
          0,
          "skip"
        ],
        "check": "$count(body.microAppRows)>0",
        "increment": 1000,
        "start": 0
      },
      "headers": {
        "X-Auth-Token": "<your Buzzy Token>",
        "X-User-Id": "<your Buzzy User Id>"
      },
      "params": {},
      "auth": {
        "user": "{{username}}",
        "pass": "{{password}}"
      },
      "data": {
        "microAppID": "3193e251fb056b5df56b9298",
        "searchFilter": [
          {
            "resourceID": "3193e251fb056b5df56b9298",
            "order": 1,
            "field": "1",
            "limit": 1000,
            "skip": 0
          }
        ],
        "buzzyFormat": false
      }
    },
    "transforms": [
      "$.body.microAppRows",
      "$.($each(function($v, $k){$k=\"location\"?{$k:$eval($v)}:{$k:$v}}) ~> $merge())"
    ]
  },
  "fields": [
    {
      "key": "_id",
      "type": "String",
      "unique": true
    },
    {
      "key": "location",
      "type": "GeoJSON"
    }
  ]
}