Template:Json PatientDirectMessageSend Block - Java
From Updox API
private static Map<String,Object> BuildMessage() throws Exception { Map<String,Object> messageData = new HashMap(); messageData.put("to","dublin@direct.updoxqa.com"); messageData.put("subject","Test Subject"); messageData.put("textMessage","Test message body"); Map<String,String> patientDemographics = new HashMap(); patientDemographics.put("patientId", "100030"); patientDemographics.put("firstName", "Jane"); patientDemographics.put("middleName", ""); patientDemographics.put("lastName", "Doe"); patientDemographics.put("dataOfBirth","1990-10-10"); patientDemographics.put("gender","F"); patientDemographics.put("emailAddress",""); messageData.put("patientDemographics", patientDemographics); Map<String, Object> params = new HashMap(); params.put("patientDemographics", patientDemographics); List<Map<String,Object>> attachments = new ArrayList<Map<String,Object>>(); Map<String,Object> attachment = new HashMap(); attachment.put("params", params); attachment.put("content", "CgoKCgoKCgoKCgoKCgoKCgoKCgoKVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1Qg VEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRF U1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lT QVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJ U0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1Qg VEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRF U1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lT QVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJ U0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1Qg VEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRF U1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lT QVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJ U0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1Qg VEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1QgVEhJU0lTQVRFU1Qg"); attachment.put("mimeType", "text/plain"); attachment.put("fileName", "test.txt"); attachments.add(attachment); Map<String,String>[] attachmentMap = attachments.toArray(new HashMap[attachments.size()]); messageData.put("attachments", attachmentMap); Map<String,String> authData = new HashMap(); authData.put("applicationId", "updox"); authData.put("applicationPassword", "password"); authData.put("accountId", "605"); authData.put("userId", "605"); messageData.put("auth", authData); return messageData; }