Difference between revisions of "API Method FaxBulkSend"
From Updox API
(→Description) |
|||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
− | The following describes the processes involved | + | The following describes the processes involved when sending bulk faxes. |
− | + | ||
+ | A bulk fax consists of a JSON call populated with: | ||
+ | - list of destination fax numbers | ||
+ | - sender name | ||
+ | - sender number | ||
+ | - Base 64 Encoded PDF file to be faxed | ||
+ | NOTE: Fax numbers may contain punctuation, although the parsed number must be exactly 10 digits long. | ||
+ | - VALID: (123) 456-7890 | ||
+ | - INVALID: 1-123-456-7890 | ||
== Prerequisites == | == Prerequisites == |
Revision as of 10:17, 1 July 2015
Contents |
Description
The following describes the processes involved when sending bulk faxes.
A bulk fax consists of a JSON call populated with:
- list of destination fax numbers - sender name - sender number - Base 64 Encoded PDF file to be faxed
NOTE: Fax numbers may contain punctuation, although the parsed number must be exactly 10 digits long.
- VALID: (123) 456-7890 - INVALID: 1-123-456-7890
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; } |
Messages
Destination Address
Request JSON
{
"recipientFaxNumbers": [ "123-456-7890", "(123) 456-7890" ], "fromName": "Us", "fromFaxNumber": "123-456-7890", "faxContent": "OurSpecialFax"
}
HTTP Response Status
200 OK
Response JSON
{
"successful": true, "responseMessage": "OK", "responseCode": 2000, "bulkSendId": 5, "validFaxCount": 1, "invalidFaxNumbers": []
}
Response Codes
2000: OK
4000: Bad Request
4010: Unauthorized (bad applicationId or applicationPassword)
4011: Unauthorized (bad accountId)
4060: Field validation error -- Message varies
4931: BulkFaxId does not exist or is unrelated to current practice