Difference between revisions of "API Method MessageListSince"
From Updox API
(Created page with "A retrieve method which is used to find specific messages happened in expected period of time for authenticated user. == Fields == Please refer to the [https://updoxqa.com/...") |
Latest revision as of 14:48, 3 December 2013
A retrieve method which is used to find specific messages happened in expected period of time for authenticated user.
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/MessageListSince"; 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("dateSince","2013-03-19"); messageData.put("dateTo", "2013-03-20"); messageData.put("start","0"); messageData.put("count","2"); messageData.put("location","I"); messageData.put("listUnreadOnly","true"); 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
{ "dateSince": "2013-03-19", "dateTo": "2013-03-20", "start": "0", "count": "2", "location": "I", "listUnreadOnly": "true", "auth": { "applicationId": "updox", "applicationPassword": "password", "accountId": "updox_acct", "userId": "updox_user" } }
Response
{ "successful": true, "responseMessage": "OK", "responseCode": 2000, "totalCount": 2, "messageCount": 2, "start": 0, "messages": [ { "messageId": "179327", "type": "message", "subject": "FAILED: Report Delivery", "received": 1363737531000, "hasAttachments": true, "location": "I", "read": false, "from": { "recipient": "0", "name": "Delivery System", "directAddress": "", "practice": null, "city": null, "state": null, "zip": null }, "to": null }, { "messageId": "179325", "type": "message", "subject": "FAILED: Report Delivery", "received": 1363737472000, "hasAttachments": true, "location": "I", "read": false, "from": { "recipient": "0", "name": "Delivery System", "directAddress": "", "practice": null, "city": null, "state": null, "zip": null }, "to": null } ] }
Error Codes
In addition to the General Error Set, this method may return the following values in the responseCode
and responseMessage
fields:
responseCode
|
responseMessage
|
---|