Forum Discussion
yarrowfish_9996
Cirrus
Jul 11, 2015Modify data-group with REST
Hi!
I would like to update/modify a data-group list with REST. Has anyone successfully done that?
/Riad
Bill_Chipman_10
Nimbostratus
Jul 13, 2015Using node.js
router.get('/', function(req, res) {
// First, verify that a userID has been supplied
var GATsecret = '', GATqrurl = '';
var GATuserid = req.query.userid;
var GATlogin = req.query.loginurl;
if ( GATuserid ) {
// Fetch the googleAppsKey records array and check for matching userid
var bipCmdList = '/sys/failover';
bip.list(bipCmdList, function(err, cres) {
console.log(cres);
var bipCmdList = '/ltm/dataGroup/internal/~Common~google_auth_keys?$select=records';
bip.list(bipCmdList, function (err, bres) {
if (err) throw err;
if (!bres.records) {
holdList = {records: []};
}
else {
holdList = bres;
}
for (var i in holdList.records) {
if (holdList.records[i].name == GATuserid) {
GATsecret = holdList.records[i].data;
}
}
if (GATsecret.length != secretLength) {
GATsecret = random32(secretLength);
var newEntry = {"name": GATuserid, "data": GATsecret};
holdList.records.push(newEntry);
var bipCmdAdd = '/ltm/dataGroup/internal/~Common~google_auth_keys';
bip.modify(bipCmdAdd, holdList, function (err, ares) {
if (err) {
console.log(err);
throw err;
}
});
}
// Build the QRcode link
GATqrurl = getQRcode(GATuserid, GATdomain, GATsecret);
// Set the variables to be passed to Jade for rendering
res.render('index', {
title: 'ZeOmega Auth Secret',
showuserid: GATuserid,
showsecret: GATsecret,
showqr: GATqrurl,
nexturl: GATlogin
});
});
});
}
==================================================================
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects