cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1391
Views
0
Helpful
2
Replies

Problem with LDAP ImportUser with application/json

Martin Sloan
Level 1
Level 1

Hello,

I'm trying to switch my CUPI application/xml messages to application/json and I'm running into an issue with the json data not being recognized on the CUC server when importing an LDAP user.  Below are examples of the XML and JSON message/response and traces.  The XML message does import the user and the JSON does not.

Messages:

Sent to: https://CUCSERVER/vmrest/import/users/ldap?templateAlias=voicemailusertemplate

XML:

<ImportUser>

     <Alias>Test User</Alias>

     <dtmfAccessId>1234</dtmfAccessId>

     <pkid>4463ea7c-bc7c-43b6-9373-5b2669c5d000</pkid>

</ImportUser>

Response:

/vmrest/users/0002b4b5-7377-4f76-9ece-7a9c26c94000

JSON:

{

  "ImportUser": {

  "Alias": "Test User",

  "dtmfAccessId": "1234",

  "pkid": "4463ea7c-bc7c-43b6-9373-5b2669c5d000"

  }

}

Response:

{

  "errors": {

  "code": "NOT_FOUND",

  "message": "no importable user found with the specified object ID: null"

  }

}

I pulled the VMREST micro traces and can see that the LDAP pkid is obtained by CUC with the XML message, but not the JSON:

XML:

com.cisco.connection.rest.provisioning.ImportUsersRestImpl  - import sql: SELECT u.pkid, u.userid, u.department, u.manager, u.mailid, u.firstname, u.lastname, u.telephonenumber FROM EndUser u WHERE u.status=1 AND u.pkid NOT IN (select fkenduser from enduserappservermap) AND u.pkid='4463ea7c-bc7c-43b6-9373-5b2669c5d000'

JSON:

com.cisco.connection.rest.provisioning.ImportUsersRestImpl  - import sql: SELECT u.pkid, u.userid, u.department, u.manager, u.mailid, u.firstname, u.lastname, u.telephonenumber FROM EndUser u WHERE u.status=1 AND u.pkid NOT IN (select fkenduser from enduserappservermap) AND u.pkid='null'

I'm not able to see the raw data in the micro traces so I'm not sure if anything is arriving correctly at CUC.  I'm using the PHP function json_encode() to format the array data to JSON.  Is there something wrong with my formatting/messaging?  I've tried this via PHP and the Firefox HTTP Resource Test plugin and get the same results.

Thanks.

1 Accepted Solution

Accepted Solutions

lindborg
Cisco Employee
Cisco Employee

you don't need the ImportUser: wrapper there - just did a quick test on my 10.5 server here and it looks like this:

POST https://192.168.0.199:8443/vmrest/import/users/ldap?templateAlias=voicemailusertemplate

body:

{

    "pkid": "blah",

    "alias": "myuser",

    "firstName": "myfirstname",

    "lastName": "mylastname",

    "dtmfAccessId": "1234"

}

and the error I get back is no PKID found "blah" which is expected...

View solution in original post

2 Replies 2

lindborg
Cisco Employee
Cisco Employee

you don't need the ImportUser: wrapper there - just did a quick test on my 10.5 server here and it looks like this:

POST https://192.168.0.199:8443/vmrest/import/users/ldap?templateAlias=voicemailusertemplate

body:

{

    "pkid": "blah",

    "alias": "myuser",

    "firstName": "myfirstname",

    "lastName": "mylastname",

    "dtmfAccessId": "1234"

}

and the error I get back is no PKID found "blah" which is expected...

Awesome, thank you.  This fixed my problem.