PureEngage On-Premises

 View Only

Sign Up

  • 1.  Contact Platform SDK

    Posted 10-30-2014 09:45
    Hi,

    I was wondering if someone could provide a complete java example to request a contact from the contact SDK based on the contact ID?
    It seems to me a bit tedious to search based on search values when we have the id, and there is also multiple different methods that may be used as far as I understand (RequestContactListGet, RequestGetContacts, RequestIdentifyContact, RequestSearch), so which one is most suitable when I already have the contact id and just want to fetch the whole contact? 

    BR
    Oskar
     


  • 2.  RE: Contact Platform SDK

    Posted 11-05-2014 01:14
    I believe you want RequestGetAttributes from PSDK, here is a dirty sample that I pieced together from some of my old code that you can re-purpose appropriately:
     
    import com.genesyslab.platform.commons.protocol.Endpoint;
    import com.genesyslab.platform.commons.protocol.Message;
    import com.genesyslab.platform.contacts.protocol.UniversalContactServerProtocol;
    import com.genesyslab.platform.contacts.protocol.contactserver.events.EventGetAttributes;
    import com.genesyslab.platform.contacts.protocol.contactserver.requests.RequestGetAttributes;
    
    public class UCSSample {
    
        private Endpoint ucsEndpoint;
        private String serverName;
        private int serverPort;
        private String clientName;
        private UniversalContactServerProtocol ucsConnection;
        
        public static void main(String[] args)
        {        
            new UCSSample();
        }
        
        public UCSSample()
        {
            serverName = "UCS_HOST_NAME";
            serverPort = 7000;
            clientName = "Some UCS Client";
            
            ucsEndpoint = new Endpoint(serverName, serverPort);
            ucsConnection = new UniversalContactServerProtocol(ucsEndpoint);
            ucsConnection.setClientName(clientName);
            
            try
            {
                ucsConnection.open();
                
                RequestGetAttributes request = new RequestGetAttributes();            
                request.setContactId("0000Pa9GCQPK1G0G");
                            
                Message response = null;            
                response = ucsConnection.request(request);
                
                if(response instanceof com.genesyslab.platform.contacts.protocol.contactserver.events.EventError)            
                    System.out.println(response.toString());            
                            
                EventGetAttributes attributes = (EventGetAttributes)response;            
                System.out.println(attributes.toString());
                
                
            } catch (Exception ex)
            {
                ex.printStackTrace();
                System.exit(-1);
            }
            finally
            {
                try { ucsConnection.close(); } catch (Exception ex) { }
            }
            
        }
    }

     


  • 3.  RE: Contact Platform SDK

    Posted 11-07-2014 14:34
    Perfect. Thank you!!