We've Moved!
Please note that we have moved to our New Forum site.
Contact Platform SDK
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
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
All
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) { } } } }All Answers
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) { } } } }