Goal: Adding a new user via API and applying details from other existing users either via template, copy or individual modification
Complexity: Medium

Preconditions: 

Related DTOs:

Usage example steps


Used FunctionsActionResults
1

POST users

Note: Values below are examples. Traits and Profiles must be defined in LUCS first.

UserDTO Example for creation

{
  "SipUri": "sip:john.doe@yourdomain.com",
  "CurrentProfile": "WeekEnd",
  "DefaultProfile": "WeekEnd",
  "Traits": [
    {
      "TraitNode": "Expertise/Customer Care Services",
      "Attribute": "Expert"
    },
    {
      "TraitNode": "Language/English",
      "Attribute": "Native"
    },
    {
      "TraitNode": "Language/German",
      "Attribute": "Native"
    }
  ],
  "Profiles": [
    {
      "Name": "Day Shift",
      "Responsibilities": [
        {
          "TraitNode": "Expertise/Customer Care Services",
          "Responsibility": "High"
        }
      ]
    },
    {
      "Name": "Night Shift",
      "Responsibilities": [
        {
          "TraitNode": "Expertise/Customer Care Services",
          "Responsibility": "High"
        }
      ]
    },
    {
      "Name": "OffDuty",
      "Responsibilities": null
    },
    {
      "Name": "WeekEnd",
      "Responsibilities": [
        {
          "TraitNode": "Expertise/Customer Care Services",
          "Responsibility": "High"
        }
      ]
    }
  ],
    "Roles": [
    {
      "OrganizationUnit": "System/Insurance Services",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    },
    {
      "OrganizationUnit": "System/Test",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    }
  ],
  "IsSelectable": true,
  "IsBlockedByLuwareApi": false,
  "NumberOfSimultaneousIm": 1,
  "ConversationAsService": "AllConversations",
  "IsBusySelectable": false,
  "IsBusyInAMeetingSelectable": false,
  "ShowAwayAsOffline": false,
  "BusyOnBusyInACallEnabled": false,
  "CanLoginToRecordingManager": false,
  "RetargetType": "NoRetarget",
  "RetargetPrivateNumber": false,
  "RetargetOnlyIfInDutyProfile": false,
  "RecordingType": "NoRecording",
  "Capabilities": {
    "Im": true,
    "Audio": true,
    "Video": false,
    "DesktopSharing": false,
    "ConversationContext": false
  }
}
TEXT

Code 200 (no error)

User is created and visible in LUCS

2GET users
  • To test the successful creation of the new user you can specify a UserIdentifier, either SIP URI or URN: In this case sip:john.doe@yourdomain.com
  • If you use GET Users without context, you will get a list of all users within the system

→ Alternatively, you can locate the user within the LUCS Configurator: LUCS Configurator → Users → List of Agents

Code 200 (no error)
3POST useridentifier copy

To copy any existing user (traits, profiles, other properties), you use an existing UserIdentifier (GET users) and create a new user with the same properties.

The userOverrides parameter consists of copyUserDTO elements, all of which are optional. It is also possible to write into fields that don't have details defined for the source user. 

userOverrides Example

{
  "FirstName": "Zany",
  "LastName": "Zerberus",
  "SipUri": "sip:smoky.zz@dev.local",
}
TEXT
A comparison of the Output and Input DTOs shows the successful copy procedure: 



Code 200 (no error)

When user already exists, Error is thrown

New User will get a unique userIdentifier, but otherwise share all details of the source user

4

Similar to copying user details you can partially override an existing users properties (traits, profiles) and apply them to any other target user. This allows for quick adaption of multiple user details via the API. 

To test this function, just create another "target" user with minimal details (→ similar to step 1)

userOverrides Example

{
  "SipUri": "sip:zany.zerberus@testdomain.com",
  "CurrentProfile": "WeekEnd",
  "DefaultProfile": "WeekEnd",
  "Traits": [
    {
      "TraitNode": "Expertise/Customer Care Services",
      "Attribute": "Expert"
    }
  ],
  "Profiles": [
    {
      "Name": "WeekEnd",
      "Responsibilities": [
        {
          "TraitNode": "Expertise/Customer Care Services",
          "Responsibility": "High"
        }
      ]
    }
  ],
    "Roles": [
    {
      "OrganizationUnit": "System/Insurance Services",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    },
    {
      "OrganizationUnit": "System/Test",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    }
  ]
}
TEXT

The system creates the user and fills in the blanks with some placeholders or default values:

userOverrides Example

{
  "Id": "e1f3667f-0df1-46d9-9bf5-4193c7a2db56",
  "SipUri": "sip:zany.zerberus@testdomain.com",
  "FirstName": null,
  "LastName": null,
  "IsBlockedByLuwareApi": false,
  "CurrentProfile": "WeekEnd",
  "DefaultProfile": "WeekEnd",
  "NotReadyReason": null,
  "NotSelectableReason": "LyncState",
  "AAConfiguration": null,
  "NumberOfSimultaneousIm": 1,
  "ConversationAsService": "NoConversations",
  "IsBusySelectable": false,
  "IsBusyInAMeetingSelectable": false,
  "ShowAwayAsOffline": false,
  "BusyOnBusyInACallEnabled": false,
  "CanLoginToRecordingManager": false,
  "RetargetType": "NoRetarget",
  "RetargetSource": null,
  "RetargetTo": null,
  "RetargetPrivateNumber": false,
  "RetargetOnlyIfInDutyProfile": false,
  "RecordingType": "NoRecording",
  "Traits": [
    {
      "TraitNode": "Expertise/Customer Care Services",
      "Attribute": "Expert"
    }
  ],
  "Profiles": [
    {
      "Name": "WeekEnd",
      "Responsibilities": [
        {
          "TraitNode": "Expertise/Customer Care Services",
          "Responsibility": "High"
        }
      ]
    }
  ],
  "Roles": [
    {
      "OrganizationUnit": "System/Insurance Services",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    },
    {
      "OrganizationUnit": "System/Test",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    }
  ],
  "OrganizationUnitNodeId": "880d7bc0-4bdd-4642-acb1-293149a06236",
  "Sid": null,
  "Sam": null,
  "Upn": null,
  "Email": null,
  "IsSelectable": false,
  "PresenceToken": "None",
  "PresenceState": "Offline",
  "Capabilities": {
    "Im": false,
    "Audio": false,
    "Video": false,
    "DesktopSharing": false,
    "ConversationContext": false
  }
}
TEXT

Now it's time to fill some of these these blanks with another user as source, using POST userid applytemplate

  • userIdentifier:  "sip:zany.zerberus@testdomain.com" which you just created as your new TARGET
  • templateUserIdentifier: "sip:smoky.rr@dev.local" an agent that chose as SOURCE template  
  • fieldsToUpdate: (an array of fiels to be copied)

userOverrides Example

[
  "Traits",
  "Profiles",
  "Roles"
]
TEXT


The response will return the updated TARGET user with new traits, profiles and roles added as required. 

(warning) Keep in mind that this is a destructive procedure which will override any existing changes on your TARGET that are not part of your SOURCE. Especially in huge arrays such as Traits or Profiles this might lead to confusion as no existing info inside your "fieldstoUpdate" will be kept or appended. 


userOverrides Example

{
  "Id": "e1f3667f-0df1-46d9-9bf5-4193c7a2db56",
  "SipUri": "sip:zany.zerberus@testdomain.com",

... shortened...

  "Traits": [
    {
      "TraitNode": "Expertise/Customer Care Services",
      "Attribute": "Expert"
    },
    {
      "TraitNode": "Language/English",
      "Attribute": "Native"
    },
    {
      "TraitNode": "Language/German",
      "Attribute": "Native"
    }
  ],
  "Profiles": [
    {
      "Name": "WeekEnd",
      "Responsibilities": []
    }
  ],
  "Roles": [
    {
      "OrganizationUnit": "System/Insurance Services",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    },
    {
      "OrganizationUnit": "System/Test",
      "Role": "AdministratorAgent",
      "Permission": "Allow"
    }
  ]
... shortened...
 
}
TEXT
→ Code 200 (with response body of TARGET user details)
5POST update users

After creation of your template users you might realize that many custom single or bulk changes are necessary outside of your available "template users". By using the POST Update function paired with updateUserDTO we can easily update specific details (or ensure they were properly set after the previous steps).

(warning) Be warned that POST update is non-cumulative, meaning that (identical to applytemplate and copy) the respective addressed parameters are overwritten. This is particularly important for Traits, as you need to define the whole set for the user again and cannot simply add extra traits with consecutive update commands. 

Example Command: POST /v1.0/users/sip:zany.zerberus@testdomain.com/update followed by (in this example shortened) updateUserDTO:

userOverrides Example

{
  "NumberOfSimultaneousIm": 3,
  "ConversationAsAService": "AllConversations",
  "CanLoginToRecordingManager": true,
  "RecordingType": "OnDemand ",
  "RetargetType": "AllConversations",
  "RetargetSourceFilter": "RedirectPSTNCallsOnly",
  "RetargetRequestTarget": "sip:smoky.transfer@dev.local",
  "Traits": [
    {
      "TraitNode": "Expertise/Customer Care Services",
      "Attribute": "Expert"
    },
    {
      "TraitNode": "Language/French",
      "Attribute": "Native"
    },
    {
      "TraitNode": "Language/German",
      "Attribute": "Advanced"
    }
  ]
}
TEXT


→ Code 200 (with response body of updated TARGET user details)

UCIDUC  LUCS API 001