API Method MessageRetrieve

From Updox API
Jump to: navigation, search

A retrieve method which sends a messageId from the authenticated user to server to search for the correspond message.

Contents

Fields

Please refer to the Interactive API for a list of the fields for this method.

Code Samples

Language Source Code Examples
C#
Java


   public void TalkToUpdox() throws Exception {
       String uri = "https://updoxqa.com/io/MessageRetrieve";
       ObjectMapper mapper = new ObjectMapper();
       Map<String,Object> messageData = BuildMessage();
       String jsonData = mapper.writeValueAsString(messageData);
       HttpResponse httpResponse = SendReceiveJSON(jsonData, uri);
       HttpEntity responseEntity = httpResponse.getEntity();
       String response = EntityUtils.toString(responseEntity);
       JsonNode actualObj = mapper.readTree(response);
 
       System.out.println(actualObj.get("responseCode"));
       System.out.println(actualObj.get("responseMessage"));
   }
 
   private Map<String,Object> BuildMessage() throws Exception
   {
       Map<String,Object> messageData = new HashMap();
       messageData.put("messageId",(long)177985);
       Map<String,String> authData = new HashMap();
       authData.put("applicationId", "updox");
       authData.put("applicationPassword", "password");
       authData.put("accountId", "updox_acct");
       authData.put("userId", "updox_user");
       messageData.put("auth", authData);
       return messageData;
   }
 
   private HttpResponse SendReceiveJSON(String jsonData, String uri) throws Exception {
       HttpClient httpClient = new DefaultHttpClient();
       HttpResponse response = null;
       StringEntity params = new StringEntity(jsonData);
       try {
           HttpPost request = new HttpPost(uri);
           request.addHeader("content-type", "application/json");
           request.setEntity(params);
           response = httpClient.execute(request);
       } catch (Exception ex) {
           // handle exception here
       } finally {
           httpClient.getConnectionManager().shutdown();
       }
       return response;
   }

Sample Request and Response

Request

 {
   "messageId": "177985",
   "auth": {
       "applicationId": "updox",
       "applicationPassword": "password",
       "accountId": "updox_acct",
       "userId": "updox_user"
    }
 }

Response

{
   "successful": true,
   "responseMessage": "OK",
   "responseCode": 2000,
   "messageId": 177985,
   "type": "email",
   "subject": "Test 918",
   "textMessage": "",
   "htmlMessage": "
", "received": 1359987498000, "from": { "recipient": "0", "name": "Mike Witting", "directAddress": "", "practice": null, "city": null, "state": null, "zip": null }, "to": { "recipient": "628", "name": "Send email to dts500@direct1.direct-test.com", "directAddress": "mike@verexis.com", "practice": null, "city": null, "state": null, "zip": null }, "attachments": [] }

Error Codes

In addition to the General Error Set, this method may return the following values in the responseCode and responseMessage fields:

responseCode responseMessage
4410 message not found