1.7 Organization API

Organizational Units are defined as a two tier structure, reflecting a company-department structure. The following API’s require the user to pass the Org Unit Name they are editing, along with the parent Org Unit. An empty string can be provided when a top level (Company) Org Unit is being created and/or edited.

1.7.1 Create Org Unit

Syntax

createOrgUnit (String name, String parent, HashMap fieldValues)

Description

This API is used to create an Organizational Unit. The Org Unit Name, the parent Org Unit Name and a map of field values are the inputs.

If the Org Unit being created is a company, pass an empty string as the parent field. If creating a department (or child org unit) the parent must already exist or an error message will be returned.

The complete list of fields that can be supplied reflect the fields returned from the get method below – but names and contact information are the general values, along with any custom fields that may be defined.

Parameters

The following are the input parameters for this API:

  1. name: The name of the Org unit to be created.

  2. parent: The name of the parent if present.

  3. fieldValues: The map of field values.

Return Value

This API returns a Map containing the success field and a message field if the method call failed.

1.7.2 Get Org Unit Details

Syntax

getOrgUnitDetails (String name, String parent)

getOrgUnitDetails (String orgUnitId)

Description

This API is used to get details of an Organizational Unit. The Org Unit id or Org Unit Name and a map of field values are the inputs.

Parameters

The following are the input parameters for this API:

  1. name: The name of the Org unit.

  2. parent: The name of the parent of the Org Unit if there are any.

  3. orgUnitId: The Org Unit Id to retrieve details from.

Return Value

This API returns a HashMap of name value pairs representing the fields of the company or department. The valid keys for organization web services are: address, addressTwo, city, state, country, zip, phone, url, primaryContact.

The returned map will also contain a success field. If there was a problem with the execution there will be a message field to explain what the issue was.

1.7.3 Update Org Unit Details

Syntax

updateOrgUnit (String name, String parent, HashMap fieldValues)

Description

This API updates the organizational unit and a parameter map containing the fields to update and the new values for those fields.

Parameters

The following are the input parameters for this API:

  1. name: The name of the Org unit

  2. parent: The name of the parent of the Org Unit if there are any

  3. fieldValues: The map of the field values.

Return Value

This API returns a HashMap containing the success field and a message field if the method call failed.

1.7.4 Rename Org Unit

Syntax

renameOrgUnit (String name, String parent, String newName)

Description

This API renames the organizational unit with the new name. The two strings name and parent are used to identify the organizational unit where a parent value of an empty string defines a company, or content in both fields defining a department.

Parameters

The following are the input parameters for this API:

  1. name: The name of the Org unit

  2. parent: The name of the parent of the Org Unit if there are any

  3. newname: The new name of the Org unit.

Return Value

This API returns a HashMap containing the success field and a message field if the method call failed.

1.7.5 Find Org Unit

Syntax

findOrgUnit (String name, String parent, HashMap fieldValues)

Description

This API is used to search for an org unit. Valid keys for the map include ‘name’ and ‘parent’ along with all the parameters defined in the org unit details method: address, addressTwo, city, state, country, zip, phone, url, primaryContact.

Parameters

The following are the input parameters for this API:

  1. name: The name of the Org unit

  2. parent: The name of the parent of the Org Unit if there are any

  3. fieldValues: The map of the field values.

Return Value

This API returns a HashMap containing the ID’s and the display strings of the org units that match the criteria along with the success field and a message field if the method call failed.

1.7.6 Delete Org Unit

Syntax

deleteOrgUnit (String orgUnitId)

Description

This API flags an Org Unit as deleted.

Parameters

The following are the input parameters for this API:

  1. orgUnitId: The Org unit id to be deleted.

Return Value

None