Retrieving corprorate email address using cupi

Version 1
    This document was generated from CDN thread

    Created by: Beena Jacob on 18-10-2013 08:07:29 AM
    How do I retrieve the corporate email address of a user using the cupi api? I didn't see it in the User object.
    I need this for UC 8.6 and above.

    Thanks,
    Beena

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Jeff Lindborg on 18-10-2013 09:12:34 AM
    it's the "emailAddress" property that's the corporate email - the smtpAddress is the internal Connection SMTP address used for internal routing.  i don't have an 8.6 handy but I'm looking on my 9.1 server here and it's served up via CUPI on the user object...

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Beena Jacob on 18-10-2013 10:26:42 AM
    I tried on UC 9.1.1. and I don't see the emailaddress property.
    This is the url I'm trying - https://10.4.105.190:8443/vmrest/users (There are only 22 users. So I didn't use row & page no options)

    Below is the user object. There is Smtpaddress & smtpproxy but no email address.

    <User><URI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc</URI><ObjectId>deefdaca-888d-4c1e-8f62-5cf37ad741cc</ObjectId><FirstName>John</FirstName><LastName>Smith</LastName><Alias>jsmith</Alias><City/><Department/><EmployeeId/><DisplayName>John Smith</DisplayName><TimeZone>0</TimeZone><CreationTime>2012-11-21T18:54:33Z</CreationTime><CosObjectId>ed4ad37b-4d4a-4f29-8a1e-ae70b69c9013</CosObjectId><CosURI>/vmrest/coses/ed4ad37b-4d4a-4f29-8a1e-ae70b69c9013</CosURI><Language>0</Language><LocationObjectId>59cd2f46-22c7-4beb-b45f-fb46af2416f4</LocationObjectId><LocationURI>/vmrest/locations/connectionlocations/59cd2f46-22c7-4beb-b45f-fb46af2416f4</LocationURI><ListInDirectory>true</ListInDirectory><IsVmEnrolled>true</IsVmEnrolled><MediaSwitchObjectId>e4b1f841-ef74-46d5-9b7a-135b6152a95f</MediaSwitchObjectId><PhoneSystemURI>/vmrest/phonesystems/e4b1f841-ef74-46d5-9b7a-135b6152a95f</PhoneSystemURI><CallHandlerObjectId>15b5f415-2351-40f4-9cf3-8e2ed525dd14</CallHandlerObjectId><CallhandlerURI>/vmrest/handlers/callhandlers/15b5f415-2351-40f4-9cf3-8e2ed525dd14</CallhandlerURI><DtmfAccessId>39091</DtmfAccessId><VoiceNameRequired>false</VoiceNameRequired><SmtpAddress>jsmith@uc9one.uc9.local</SmtpAddress><PartitionObjectId>a5a968d9-750a-4ffe-8d26-9d94908158a1</PartitionObjectId><PartitionURI>/vmrest/partitions/a5a968d9-750a-4ffe-8d26-9d94908158a1</PartitionURI><MwisURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/mwis</MwisURI><NotificationDevicesURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/notificationdevices</NotificationDevicesURI><MessageHandlersURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/messagehandlers</MessageHandlersURI><ExternalServiceAccountsURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/externalserviceaccounts</ExternalServiceAccountsURI><AlternateExtensionsURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/alternateextensions</AlternateExtensionsURI><PrivateListsURI>/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc/privatelists</PrivateListsURI><SmtpProxyAddressesURI>/vmrest/smtpproxyaddresses?query=(ObjectGlobalUserObjectId%20is%20deefdaca-888d-4c1e-8f62-5cf37ad741cc)</SmtpProxyAddressesURI><AlternateNamesURI>/vmrest/alternatenames?query=(GlobalUserObjectId%20is%20deefdaca-888d-4c1e-8f62-5cf37ad741cc)</AlternateNamesURI></User>

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Beena Jacob on 18-10-2013 10:44:53 AM
    Is there a way to retrieve emailaddress of all users in bulk? Maybe a search query?
    If I use the full_user listing then it'll be 1 https request per user. 

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Jeff Lindborg on 18-10-2013 10:34:34 AM
    right - that's the "short version" of the user that's presented in lists - you're listing out a bunch of them so you only get a limited amount of data.  To get the _full_ user listing you need to fetch the single user with their objectid - so something like this: https://10.4.105.190:8443/vmrest/users/deefdaca-888d-4c1e-8f62-5cf37ad741cc.   You can see that path presented in the "URI" property for the short user - if you do a get with that you'll see many more properties for the user (far more than we'd want to present in lists of users which would be very expensive).

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Jeff Lindborg on 18-10-2013 11:14:00 AM
    you can't query on non indexed items (all the items in the short user presentation are indexed - they are commonly needed for finding users and hence the overhead of indexing those fields was done) - corporate email (and all other items on the user full list) are not indexed (we can't index everything - too expensive) and since corporate email is optional it's not and you cannot filter on it globally.  REST as a rule is not fantastic for bulk type operations - which is why there are SQL type interfaces (via HTTP like AXL or ODBC for Connection) that are used for bulk/batch operations.  For instance doing a version of COBRAS with REST would mean backups would take days... it would work but is not the most efficient way of handling many, many objects. 

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Beena Jacob on 18-10-2013 11:37:13 AM
    Can I still use cuals service or has that been deprecated?

    Subject: RE: Retrieving corprorate email address using cupi
    Replied by: Jeff Lindborg on 18-10-2013 04:35:47 PM
    to be clear, use of CUALs outside of internal use has never been supported (i.e. TAC wont help you with problems you may have with it) but it's still in there and probably will be indefinitely - COBRAS makes use of it (for greetings/voice names) - REST calls work in more recent versions for this but COBRAS has to go back to 7.0(2) which is pre-REST so it simply uses CUALS for all versions for getting/setting voice names and greetings to simplify the code.