Adding Objects - BlueCat Address Manager - 9.0.0

Address Manager API Guide

Locale
English (United States)
Product name
BlueCat Address Manager
Version
9.0.0

There are several ways to add objects to Address Manager via the API. This section contains examples of these methods, including a generic addEntity method as well methods for adding specific objects in Address Manager.

Generic addEntity()

addEntity() is a generic adding method that can be used to create any object. In this example, we are adding a IP4Block in Address Manager.

// Signature: addEntity( long parentId, APIEntity entity )

// Form the entity object with the data
APIEntity blockEntity = new APIEntity();
// Specify Name
blockEntity.setName( "blockName" ); 
// Specify Type
blockEntity.setType( ObjectTypes.IP4Block ); 
// Specify additional properties required to define object
blockEntity.setProperties( ObjectProperties.CIDR + "=192.168.0.0/16" ); 

// Add this entity under the defined parent
long blockId = service.addEntity( configId, blockEntity );

Specific add methods

There are other add methods that can be used to add specific different objects. In this example, we are adding a IP4Block in Address Manager.

// Signature: addIP4BlockByCIDR( long parentId, String CIDR, String properties )

// Add the block specifying the CIDR. Name has to be specified using properties in this case
String properties = ObjectProperties.name + "=blockName2";
long blockId = service.addIP4BlockByCIDR( configId, "20.0.0/16", properties );