Cisco Unity Connection Provisioning Interface (CUPI) API -- User Import
From DocWiki
Revision as of 22:38, 13 December 2010
Links to Other API pages: Cisco_Unity_Connection_APIs
| CUPI Guide Contents |
| API Overview Index of All CUPI Documentation |
Contents |
Differences Between LDAP Import and CUCMBE Import
There are very few differences between an LDAP import and a Cisco Unified Communications Manager Business Edition (CUCMBE) import. The primary differences involve the dtmfAccessId.
A GET of an LDAP user will have a phone number, whereas a CUCMBE user will have a dtmfAccessId (based on data in the Cisco Unified Communications Manager (CUCM) database).
When a user is imported, an LDAP import must specify a dtmfAccessId in the payload (this is often based on the phone number). A CUCMBE import will use the value that comes from the CUCM database for the dtmfAccessId.
In this document, <type> in a URI refers to one of these values: ldap or cucmbe.
Initial Configuration
Before any LDAP users can be imported, the LDAP synchronization has to be set as described in this section of the Design Guide for Cisco Unity Connection 8.x.
For CUCM user import, users are first created in the CUCM system. Prior to import, the creation of a user account must be done as described in this section of the User Moves, Adds, and Changes Guide for Cisco Unity Connection 8.x.
The important point for a CUCMBE import is that the user must have a primary directory number. This is a Cisco Unified Communications Manager concept, but it effectively means that the user must have at least one device, that device must have at least one line number, and that line number needs to be assigned as the user's primary DN.
GET a List of Users That Can Be Imported
GET http://<server>/vmrest/import/users/<type>
Only users that are eligible for import are returned; users that are already imported are not in this list.
Offset and Limit Parameters Can Be Part of the ldap Query
http://<server>/vmrest/import/users/<type>?offset=x&limit=y
Note the following:
- Either parameter can be specified individually
- If the offset exceeds the number of entries, the response is an empty list
- If no limit is specified and more than 2000 results are returned, the response is an error
Filter and Sort
To put constraints on search results, LDAP requests support the CUPI standard filter and sort parameters.
Example
GET /vmrest/import/users/ldap?limit=5 HTTP/1.1 Accept: application/json User-Agent: Java/1.6.0_20 Host: cuc-install-69.cisco.com Connection: keep-alive Authorization: Basic Y2NtYWRtaW5pc3RyYXRvcjplY3NidWxhYg==
The GET above would produce the following response:
HTTP/1.1 200 OK
Pragma: No-cache
Cache-Control: no-cache
Expires: Wed, 31 Dec 1969 16:00:00 PST
Set-Cookie: JSESSIONIDSSO=11D3599617B30496BAD4BF2BB4C23B32; Path=/
Set-Cookie: JSESSIONID=2D9E4ACB334EF6DED8734E51EDDDB7F9; Path=/vmrest
Content-Type: application/json
Transfer-Encoding: chunked
Date: Wed, 28 Apr 2010 19:39:03 GMT
Server:
\{"ImportUser":\[\{"alias":"ui","firstName":"unity","lastName":"install","pkid":"af7dea71-d6c7-47d9-b1db-44190073cf6c"\},\{"alias":"um","firstName":"unity","lastName":"msgstore","pkid":"452caa72-57e5-4644-a14c-f6e147a66e54"\},\{"alias":"ud","firstName":"unity","lastName":"dirsvc","pkid":"8bff5502-64f2-4425-9381-7ff524aea491"\},\{"alias":"ua","firstName":"unity","lastName":"admin","pkid":"7ddba5d6-9eaa-4a92-8513-a9454141d27c"\},\{"alias":"S-SvrG","firstName":"Sonya","lastName":"ServerG","pkid":"aca43d25-4aa3-4270-a174-e5e9f1c3b5b5"\}\]\}
Import a User
POST http://<server>/vmrest/import/users/<type>?templateAlias=<voice mail user template> with an ImportUser object as payload
An important point here is that because these users are imported, almost all values come from the internal database. The only value used on a CUCMBE import is the pkid of the passed-in user. The rest of the fields are ignored and their values are pulled from the CUCM database during the import process. One exception for an LDAP import is the dtmfAccessId. The dtmfAccessId data is not available in the internal database, so an LDAP import must specify both a pkid and a dtmfAccessId.
For example:
POST /vmrest/import/users/ldap?templateAlias=voicemailusertemplate HTTP/1.1
Content-Type: application/json
User-Agent: Java/1.6.0_20
Host: cuc-install-69.cisco.com
Accept: text/html, image/gif, image/jpeg, \*; q=.2, \*/*; q=.2
Connection: keep-alive
Authorization: Basic Y2NtYWRtaW5pc3RyYXRvcjplY3NidWxhYg==
Content-Length: 126
\{"alias":"sdavis","firstName":"sonya","lastName":"davis","dtmfAccessId":"12123","pkid":"c2e2bf1c-f249-40e5-b7b8-31a5b0333647"\}
The POST above would produce the following response:
HTTP/1.1 201 Created