Difference between revisions of "API Method PracticeCreate"

From Updox API
Jump to: navigation, search
Line 14: Line 14:
 
| width="50px"| C# || <div class="mw-collapsible mw-collapsed" style="width:65px">
 
| width="50px"| C# || <div class="mw-collapsible mw-collapsed" style="width:65px">
 
<div class="mw-collapsible-content" style="width:810px">
 
<div class="mw-collapsible-content" style="width:810px">
 +
<syntaxhighlight lang="csharp">
 
{{Core Method Header - CSharp}}
 
{{Core Method Header - CSharp}}
 
{{Json Practice Block - CSharp}}
 
{{Json Practice Block - CSharp}}
Line 19: Line 20:
 
{{Core Method Footer - CSharp|practiceCreate|practiceCreate}}
 
{{Core Method Footer - CSharp|practiceCreate|practiceCreate}}
 
{{Base_Code_for_Consuming_API_Using_CSharp}}
 
{{Base_Code_for_Consuming_API_Using_CSharp}}
</div>
+
</syntaxhighlight>
 
</div>
 
</div>
 
|-
 
|-
Line 25: Line 26:
 
<div class="mw-collapsible-content" style="width:810px">
 
<div class="mw-collapsible-content" style="width:810px">
 
{{Talk To Updox - Core - Java|practiceCreate|practiceCreate}}
 
{{Talk To Updox - Core - Java|practiceCreate|practiceCreate}}
 
 
 
{{Json Practice Block - Java}}
 
{{Json Practice Block - Java}}
 
 
 
{{Base_Code_for_Consuming_API_Using_Java}}
 
{{Base_Code_for_Consuming_API_Using_Java}}
 
 
|}
 
|}
  

Revision as of 14:37, 20 November 2013


Contents

Description

The following code samples describe the processes involved in adding a new practice.

Prerequisites

  1. This API call requires Vendor-level credentials. The credentials should be populated into the applicationId and applicationPassword fields of the auth block.

Code Samples

Language Source Code Examples
C#
{{Core Method Header - CSharp}}
{{Json Practice Block - CSharp}}
{{Json Auth Block - Application - CSharp}}
{{Core Method Footer - CSharp|practiceCreate|practiceCreate}}
{{Base_Code_for_Consuming_API_Using_CSharp}}
Java


   public void TalkToUpdox() throws Exception {
       String uri = "https://updoxqa.com/io/practiceCreate";
       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("accountId","NewPracticeId"); //required
       messageData.put("name","Family Practice"); //required
       messageData.put("address1", "94 N. High St");
       messageData.put("address2", "Suite 100");
       messageData.put("city", "Dublin");
       messageData.put("state", "OH");
       messageData.put("postal", "43017");
       messageData.put("phone", "6147988170");
       messageData.put("fax", "6144074411");
       messageData.put("directAddress", "practice_direct");
       messageData.put("directDomain", "new_practice");
       messageData.put("timeZone", "America/Chicago");
       messageData.put("websiteAddress", "practice_website");
       messageData.put("active","true"); //recommended, defaults to "false"
       
       Map<String,String> authData = new HashMap();
       authData.put("applicationId", "vendorId");
       authData.put("applicationPassword", "vendorPassword");
       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;
   }

Messages

Request JSON

 {
   "accountId": "NewPracticeId",
   "name": "NewPracticeName",
   ...
   "active": "true",
   "auth": {
       "applicationId": "vendorId",
       "applicationPassword": "vendorPassword"
   }
 }

HTTP Response Status

 200 OK

Response JSON

 {
   "successful": true,
   "responseMessage": "OK",
   "responseCode": 2000,
   "accountId": "NewPracticeId",
   "action": "create"
 }


Relevant Response Codes

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

responseCode responseMessage
4110 no practice ID
4130 account already exists
4140 web address is already taken
4610 direct address error: direct address is taken
4620 direct address error: domain does not match the direct domain for this account
4630 direct address error: account does not have a direct domain configured