Difference between revisions of "API Method EventNotificationBulkCreate"
From Updox API
(→Field Validations) |
(→Prerequisites) |
||
Line 40: | Line 40: | ||
{{PreReq Account Identifier}} | {{PreReq Account Identifier}} | ||
+ | |||
+ | == Code Samples == | ||
+ | {| 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"> | ||
+ | <div class="mw-collapsible-content" style="width:810px"> | ||
+ | |||
+ | {{Core Method Header - CSharp}} | ||
+ | {{Json BulkFax Block - CSharp}} | ||
+ | {{Json Auth Block - Account - CSharp}} | ||
+ | {{Core Method Footer - CSharp|faxBulkSend|faxBulkSend}} | ||
+ | |||
+ | {{Base_Code_for_Consuming_API_Using_CSharp}} | ||
+ | </div> | ||
+ | |- | ||
+ | | 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|faxBulkSend|faxBulkSend}} | ||
+ | |||
+ | {{Json bulkFaxSend Block - Java}} | ||
+ | |||
+ | {{Base_Code_for_Consuming_API_Using_Java}} | ||
+ | |} |
Revision as of 16:26, 11 December 2015
Contents |
Description
The following describes the processes involved when sending bulk event notifications.
A bulk event notification consists of a JSON object populated with a list of:
- payload (the content of the notification) - internal id (an identification id specified by the requester) - delivery date/time - delivery method
Field Validations
payload
- Required - The content of payload cannot be empty, otherwise the notification will be considered invalid.
internalId
- Not Required - This field is here as a way for a requester to track their notifications being created.
deliveryDateTime
- Not Required - This will default to the current date/time if not provided, hence the notification will be scheduled to be sent right away.
- Date/Time Format: yyyy-MM-ddTHH:mm:ss
- Example: 2015-01-01T14:01:00
- Date/Time Format: yyyy-MM-ddTHH:mm:ss
deliveryDestination
- Required - The destination must match the format associate with the delivery method.
- Phone Number - The phone number can contain formatting, but the maximum number of digits is 10. This cannot be used, if a method of EMAIL is specified for the delivery method.
- Example: 333-222-4567 resolves to 3332224567
- Email Address - This must be a valid email address. This cannot be used, if a method of SMS is specified for the delivery method.
- Example: abc123@alphabet.com
- Phone Number - The phone number can contain formatting, but the maximum number of digits is 10. This cannot be used, if a method of EMAIL is specified for the delivery method.
deliveryMethod
- Required - The method by which the notification will be delivered. The list of acceptable values include:
- SMS - This is case insensitive and will specify that the notification is to be delivered via text messaging.
Prerequisites
1 This API call requires Vendor-level credentials. The credentials should be populated into the applicationId
and applicationPassword
fields of the auth
block:
{ ... "auth": { "applicationId": "vendorId", "applicationPassword": "vendorPassword", "accountId": "", "userId": "" } }
2 This API call requires a Practice/Account-level identifier. The identifier should be populated into the accountId
field of the auth
block:
{
...
"auth": {
"applicationId": "vendorId",
"applicationPassword": "vendorPassword",
"accountId": "practiceId",
"userId": ""
}
}
Code Samples
Language | Source Code Examples |
---|---|
C# | public void TalkToUpdox() { string json = new JavaScriptSerializer().Serialize(new { recipientFaxNumbers = new List<String>() { "123-456-7890" }, fromName = "Us", fromFaxNumber = "123-456-7890", faxContent = "Base64EncodedSecretContent", auth = new { applicationId = "vendorId", applicationPassword = "vendorPassword", accountId = "accountId", userId = "" } }); string url = "https://updoxqa.com/io/faxBulkSend"; SendReceiveJSON(json, url); } private void SendReceiveJSON(string json, string url) { var httpWebRequest = WebRequest.Create(url); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); var httpResponse = (HttpWebResponse) httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } } } |
Java |
public void TalkToUpdox() throws Exception { String uri = "https://updoxqa.com/io/faxBulkSend"; 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(); List<String> recipientFaxNumbers = new ArrayList<String>(); recipientFaxNumbers.add("123-456-7890"); messageData.put("recipientFaxNumbers",recipientFaxNumbers); messageData.put("fromName","Us"); messageData.put("fromFaxNumber","123-456-7890"); messageData.put("faxContent","Base64EncodedFaxContent"); authData.put("applicationId", "vendorId"); authData.put("applicationPassword", "vendorPassword"); authData.put("accountId", "accountId"); 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; } |