CUPI - create User Template

Version 1
    This document was generated from CDN thread

    Created by: Ryan Ash on 17-09-2012 05:29:05 PM
    Is the creation of a User Template allows via CUPI?  I cannot find any documentation on the creation of usertemplates.  The GET is fully functionality.  If it is allowed can someone point me in the right direction of documentation showing required params for the POST? 
     
    Ryan

    Subject: RE: CUPI - create User Template
    Replied by: Akanksha Agarwal on 18-09-2012 04:52:06 AM
    Hi Ryan,

    Yes, it is allowed to create a user template via REST APIs.

    You need to do the following for achieving this:

    POST: https://<Connection-ip>/vmrest/usertemplates?templateAlias=<template>

    Where template for a voice mail user would be "voicemailusertemplate", so the request would become

    https://<Connection-ip>/vmrest/usertemplates?templateAlias=voicemailusertemplate

    And in the request xml body you can give:

    <UserTemplate>
          <Alias>AkkiTemplate</Alias>
          <DisplayName>Akanksha Template</DisplayName>
    </UserTemplate>

    As a response, you will receive the user template object id. You can view this template by hitting a GET : https://<Connection-ip>/vmrest/usertemplates

    Let me know if you have any other question.

    Thanks & Regards,
    Akanksha A

    Subject: RE: CUPI - create User Template
    Replied by: Ting-Hao Chen on 18-09-2012 03:48:00 PM
    Cisco Unity Connection Provisioning Interface (CUPI) API -- HTML Notification Templates

    Howard

    Subject: RE: CUPI - create User Template
    Replied by: Ryan Ash on 18-09-2012 08:40:31 AM
    Wonderful...THanks!

    What doc should I be using to answer these questions?  The schema?

    Subject: RE: CUPI - create User Template
    Replied by: Jeff Lindborg on 18-09-2012 04:22:41 PM


    notification templates and user templates are not the same thing... notification templates were added in 9.x for HTML notifications with customized properties - as far as I know there's no sample/documentation spelling out creating/editing user templates on the WIKI.
     

    Subject: RE: CUPI - create User Template
    Replied by: Akanksha Agarwal on 20-09-2012 12:16:53 AM
    For user templates, there is no example in our existing docs. We will be publishing this with our new release documentation. If you have any question for any API that is missing in the docs, please drop us a query at this forum. We'll answer it at the earliest.

    Subject: CUPI - create User
    Replied by: Christian LUDGER on 23-01-2013 07:26:41 AM
    Hello,
      I am trying to create a user in a version 7.1.5 Unity Connection server.
    A use the following informations:
    - Method: POST
    - URI: https://10.230.110.177:8443/vmrest/users?templateAlias=voicemailusertemplate

    - XML Data:
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <User>
      <Alias>tst2345</Alias>
      <LastName>PROVUser</LastName>
      <FirstName>Test1</FirstName>
      <DisplayName>Test1 PROVUser</DisplayName>
      <DtmfAccessId>23456</DtmfAccessId>
    </User>


    I got the following error: The remote server returned an error: (400) Bad Request
    For information, I can get, update and delete a user. Only the create process fail!
    Christian

    Subject: RE: CUPI - create User
    Replied by: Utkarsh Katiyar on 23-01-2013 09:21:24 AM
    Hey Christian,

    What's the complete output of the failed request? Also which version of 7.1.5 are you using?
    -Utkarsh

    Subject: RE: CUPI - create User
    Replied by: Christian LUDGER on 23-01-2013 09:34:19 AM
    Hello Utkarsh,

      The exact version is 7.1.5.0ES33

      And for the request, I got an exception when I send the request to the server with the error message giving in my first post. So I don't receive any answer to my request ... and I don't have any other information.

    Christian
     

    Subject: RE: CUPI - create User Template
    Replied by: Utkarsh Katiyar on 23-01-2013 11:03:32 AM
    Hmm......Can you share the code snippet where you are making the request and sending it to the server.

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 24-01-2013 01:43:27 AM
    Hello,
      My code is based on the sample available on the CUPI documentation (http://developer.cisco.com/documents/4453236/4479360/VoiceMailboxQuotaReport.zip/f2437d92-fe8b-4cc9-9729-674ea5827ad3?version=1.0).
    All the others actions work correctly.
    I can get (GET method), update (PUT method) and delete (DELETE method) existing users or update user's PIN code.
    I try yesterday to create a "user template" an I got 405 (405 Method Not Allowed ) exception error. It's normal "user template" creation is not allowed with our CUC version !
    So can you help me to find where is the mistake in my create action.
    Best regards
    Christian
     

    Subject: RE: CUPI - create User Template
    Replied by: Utkarsh Katiyar on 24-01-2013 07:22:10 AM
    I tried it with a 7.1.5ES setup and my java API works fine for the POST operation. Not very much familiar with the .NET api though.
    As far as I am suspecting, this can be a case of incorrect request format. Try creating some object other than user like a callhandler, cos, partition etc. and see if you get the same error or not.

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 24-01-2013 08:17:18 AM
    Hello,
      I have tried to do to POST actions:

    First one, I tried to create a contact with the following informations:
    - Method: POST
    - URI: https://10.230.110.177:8443/vmrest/contacts?templateAlias=voicemailusertemplate
    - XML Data: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Contact><Alias>ctc2345</Alias><DisplayName>ctc2345</DisplayName></Contact>
    For this firts test, I got the same error: The remote server returned an error: (400) Bad Request.
    -------------------------------
    On a second time, I tried a POST to reset a user's MWI with the following informations:
    - Method: POST
    - URI: https://10.230.110.177:8443/vmrest/users/75adf033-6a05-4460-bc58-e623186924ec?method=resetmwi
    - XML Data: Nothing
    For this second test, I got the result code: 204 - NoContent
    Thus it works on the second test ...
    Have you some idea ?


    Christian

    Subject: RE: CUPI - create User Template
    Replied by: Utkarsh Katiyar on 24-01-2013 08:59:54 AM
    Aah.....There you go. It means there can be some issue in creating the request. A couple of things to check:
    1. Check the content-type header which you are setting while sending the POST request.
    2. The request body which you are setting while sending the POST request.
    3. Check the request details using something like Fiddler.
    Do share those details.

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 24-01-2013 09:27:47 AM
    OK, I can try to get these informations but why did it work when I do a PUT action like this:
    - Method: PUT
    - URI: https://10.230.110.177:8443/vmrest/users/75adf033-6a05-4460-bc58-e623186924ec
    - XML Data: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <User>
      <Alias>tst12345</Alias>
      <LastName>PROVUser</LastName>
      <FirstName>Test</FirstName>
      <DisplayName>Test PROVUser</DisplayName>
      <DtmfAccessId>12345</DtmfAccessId>
    </User>
    I use the same programming code for the two actions. I only change the method ....

    Subject: RE: CUPI - create User Template
    Replied by: Utkarsh Katiyar on 24-01-2013 10:13:30 AM
    Thats what needs to be checked. The fiddler output will help in this case.

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 25-01-2013 07:21:54 AM
    Hello,
      I don't know fiddler and I don't have a lot of time to understand, install, parameter and use it !
    Is it possible to get traces on the unity connection server concerning vmrest requests ?
    To see what is received and eventually what is wrong ...
    Christian

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 28-01-2013 03:38:05 AM
    Hello,
      Finally, I found where I can get traces on CUPI requests ...
    When I try to add a user, I got the following traces :
    01/28/2013 10:31:09.110 |12422,,,VMREST,3,DEBUG [http-8443-2] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - created authentication information: username=testprov, alias=testprov, id=a76ab312-5967-42d3-b15f-2a834c94808a|
    01/28/2013 10:31:09.118 |12422,,,VMREST,3,DEBUG [http-8443-2] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - returning session cached authentication information: alias=testprov, id=a76ab312-5967-42d3-b15f-2a834c94808a|
    01/28/2013 10:31:09.887 |12422,,,VMREST,3,ERROR [http-8443-2] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - unable to create a subscriber|
    01/28/2013 10:31:09.887 |12422,,,VMREST,3,ERROR [http-8443-2] com.cisco.connection.rest.helper.Utilities  - The Phone Number/Extension has violated a restriction in the restriction table. Phone Number/Extension = [vUserMwiExtension], Restriction Type = |

    Can you explain me why I got a "phone number violation" error ?
    If I try to create the user with the same information on the "administration" web page, it works correctly ...
    Best regards
    Christian

    Subject: RE: CUPI - create User Template
    Replied by: Utkarsh Katiyar on 28-01-2013 08:36:18 AM
    Alright. So you must be getting an error XML in the response something like <ErrorDetails><errors>.....That's why I asked for the complete output of the request.
    This issue has been fixed as a part of CSCty85181 in 8.0ES and above branches.

    Subject: RE: CUPI - create User Template
    Replied by: Christian LUDGER on 29-01-2013 12:40:34 AM
    Hello,
      Thanks for this information ... I used the workaround (suppressing the restriction on outdial ...) and now I can create users !
      For your information, in my version when a create action doesn't work, the http request fails and doesn't get an answer. I got only an exception ! So I haven't any information on the error ...
      My conclusion is that VMREST is a very poor interface for managing Unity Connection servers. It's very far from the AXL SOAP API interface available on CallManager environments. Is there a more suitable solution for managing Unity Connection ?
    Best regards
    Christian