Quantcast
Channel: Infoblox Community - Infoblox Community Blog
Viewing all articles
Browse latest Browse all 76

Importing users into NetMRI via the API

$
0
0

Here's a perl script that shows how you can use the API to import users into NetMRI

use strict;
use warnings;
use NetMRI::API;
# Comment this out if you are using HTTPS$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
# get the device id from the command# line as the first argument.
# Connect to the NetMRI.
my $client = new NetMRI::API({
     api_version =>'2.8',
 });
 ##################################
 #The "users_list.data" files needs to be in the following format
 #username,password,email,firstname,lastname
 #################################
 #open (READ_USERS, 'users_list.data');
 ##################################
 #Now we will read through each line in the file and assign them to variables
 ##################################
 my $broker = $client->broker->auth_user;
 while ( my $ask= ){
   my @list = split(/,/, $ask);
   my $list_username = $list[0];
   my $list_password = $list[1];
   my $list_email = $list[2];
   my $firstname = $list[3];
   my $lastname = $list[4];
   $broker->
   create(email =>list_email,first_name =>
    $firstname,last_name =>
    $lastname,password_secure =>
    $list_password,user_name =>
    $list_username);
 }

Tags: 


Viewing all articles
Browse latest Browse all 76

Trending Articles