Difference between revisions of "API Method MessageCountSince"

From Updox API
Jump to: navigation, search
(Created page with "== FAQ == ==== Why am I getting a "messageCount" of 50 returned from the MessageListSince call but a "totalCount" of 1? ==== This is normal. The messageCount field is the to...")
 
 
Line 1: Line 1:
== FAQ ==
+
A method which is used to find every message since expected date for authenticated user.
 +
 
 +
== Fields ==
 +
Please refer to the [https://updoxqa.com/iodox/updox-iodox Interactive API] for a list of the fields for this method.
  
==== Why am I getting a "messageCount" of 50 returned from the MessageListSince call but a "totalCount" of 1? ====  
+
== Code Samples ==
This is normal. The messageCount field is the total number of messages that could be returned by the call. It is the same value as the messageCount field that's passed into the request, but if that field is null then the default is 50. This is to help support paging. So, for example, you could pass in 15 for "messageCount" and 16 for "start" and we will give you back 15 items starting with the 16th item.
+
{| class="wikitable" style="width:900px; vertical-align:top; align:left"
 +
! Language || Source Code Examples
 +
|-
 +
| width="50px"| C# || <div class="mw-collapsible mw-collapsed" style="width:65px">
 +
|-
 +
| align="top" | Java || <div class="mw-collapsible mw-collapsed" style="width:65px">
 +
<div class="mw-collapsible-content" style="width:810px">
 +
{{Talk To Updox - Core - Java|MessageCountSince|MessageCountSince}}
 +
 
 +
{{Json MessageCountSince Block - Java}}
 +
 
 +
{{Base_Code_for_Consuming_API_Using_Java}}
 +
|}
 +
 
 +
== Sample Request and Response ==
 +
 
 +
==== Request ====
 +
 
 +
  {
 +
    "dateSince": "2013-03-20",
 +
    "countUnreadOnly": "true",
 +
    "auth": {
 +
        "applicationId": "updox",
 +
        "applicationPassword": "password",
 +
        "accountId": "updox_acct",
 +
        "userId": "updox_user"
 +
    }
 +
  }
 +
 
 +
==== Response ====
 +
 
 +
{
 +
    "successful": true,
 +
    "responseMessage": "OK",
 +
    "responseCode": 2000,
 +
    "locations": [
 +
        {
 +
            "count": 28826,
 +
            "location": "I"
 +
        },
 +
        {
 +
            "count": 16,
 +
            "location": "T"
 +
        }
 +
    ],
 +
    "records": [
 +
        {
 +
            "count": 19,
 +
            "type": "email"
 +
        },
 +
        {
 +
            "count": 15,
 +
            "type": "fax"
 +
        },
 +
        {
 +
            "count": 28805,
 +
            "type": "message"
 +
        },
 +
        {
 +
            "count": 2,
 +
            "type": "print"
 +
        },
 +
        {
 +
            "count": 1,
 +
            "type": "upload"
 +
        }
 +
    ],
 +
    "count": 28842
 +
}
 +
== Error Codes ==
 +
 
 +
{{Relevant Response Codes Table Header}}

Latest revision as of 14:55, 3 December 2013

A method which is used to find every message since expected date 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/MessageCountSince";
       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-20");
       messageData.put("countUnreadOnly","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-20",
   "countUnreadOnly": "true",
   "auth": {
       "applicationId": "updox",
       "applicationPassword": "password",
       "accountId": "updox_acct",
       "userId": "updox_user"
   }
}

Response

{
   "successful": true,
   "responseMessage": "OK",
   "responseCode": 2000,
   "locations": [
       {
           "count": 28826,
           "location": "I"
       },
       {
           "count": 16,
           "location": "T"
       }
   ],
   "records": [
       {
           "count": 19,
           "type": "email"
       },
       {
           "count": 15,
           "type": "fax"
       },
       {
           "count": 28805,
           "type": "message"
       },
       {
           "count": 2,
           "type": "print"
       },
       {
           "count": 1,
           "type": "upload"
       }
   ],
   "count": 28842
}

Error Codes

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

responseCode responseMessage