There are 3 utils in this repo,
- Download / Backup the API Bass content
- Cleanup an Existing Org / App in API Baas
- Upload data to an API Baas Org / App
#Edit config.js
var config = {} ;
config.org = 'yourOrg';
config.app = 'yourApp';
config.uri = "http://api.usergrid.com" ;
module.exports = config ;
#Give Permissions for the client In API Baas, add "/**" permission to the Role "Guest"
#Sample
#Download/Backup
npm install request
node download.js
#Cleanup
node cleanup
#Upload
node upload.js
#Tip While uploading, you may not need the following collections - roles, notifiers, receipts, notifications
So, if you do not need some collections to be uploaded to the API Baas, simple delete the corresponding
files from data/{collection}.json
It uses the API Baas APIs to perform these tasks
-
Read
/org/app
-> It returns metadata about Collections in the org, with the count -
Iterate each collection ,
/org/app/collection
- to download all entities [it paginates, with page size of 1000] -
Store the collection array in a file
data/collection.json
-
Upload uses these files as source for data
-
Uses the API
POST /org/app/collection
, with the entire array. [usually worked for more then 1000 elements, We could batch it with a size of 1000 - let me know if you think this is the case] -
Cleanup again uses the API to delete all entities in a collection
We could even retain all the UUIDs and the Connections, but it will take much longer time to migrate, but it will be worth a try