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
- If required, schedule a maintenance period to transfer the data.
- Stop all the traffic to the source Microapp
- Create a empty Microapp (Application) for the destination
- Select the Properties, Advanced, Data Source, URL Import.
- Enter the JSONata script
- Preview the results and make any required changes
- Select Import
- 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"
}
]
}