cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

UCSD - CloupiaScript Example to Create New User Group via Northbound API

3157
Views
1
Helpful
0
Comments

Task Name

UCSD 6.5 has global Variables that the user can define. These workflows can create and update and read and delete these variables

Description

Prerequisites

  1. 1. Works only on 6.5 and above

Category

CloupiaScript

Components

User Inputs

The following CloupiaScript can be used to create a new user group via an API call:

importClass(com.cisco.cuic.api.client.APIGroup);

importClass(com.cisco.cuic.api.client.CuicServer);

importClass(com.cisco.cuic.api.models.UserAPIGlobal);

var ucsdIP = "10.52.249.102";

var xCloupiaRequestKey = "E85B98439B194AAFB82A022BCCD83214";

var groupName = "TestGroup";

var email = "rwhitear@cisco.com";

var firstName = "Russ";

var lastName = "Whitear";

var address = "Bedfont";

var description = "Created by an API call";

var phoneNo = "123456789";


var server = CuicServer.getAPI(ucsdIP, xCloupiaRequestKey, "https", 8443);

 

var instance = new UserAPIGlobal(server);

 

var apiGroup = new  APIGroup();

 

apiGroup.setGroupName(groupName); //Mandatory

apiGroup.setEmailAddress(email); //Mandatory

//apiGroup.setGroupType(0); //Optional- can accept either 0 or 1; by default 0.

//apiGroup.setParentGroupId(2); //Optional

//apiGroup.setParentGroupName("MSP ORG 1"); //Optional

apiGroup.setFirstName(firstName); //Optional

apiGroup.setLastName(lastName); //Optional

apiGroup.setAddress(address); //Optional

apiGroup.setDescription(description); //Optional

apiGroup.setPhoneNumber(phoneNo); //Optional

var groupId = instance.userAPICreateGroup(apiGroup);

 

logger.addInfo("Group Id for the group created: "+groupId);

Content for Community-Ad
This widget could not be displayed.