Difference between revisions of "API Method AppointmentsSync"
From Updox API
(Created page with " == Description == Method that allows the syncing of organization's appointments. == Behind the Scenes == System will parse list of contacts and attempt to find existing...") |
(→Code Samples) |
||
(One intermediate revision by one user not shown) | |||
Line 3: | Line 3: | ||
== Description == | == Description == | ||
− | Method that allows the syncing of organization's appointments. | + | Method that allows the syncing of organization's patient appointments. |
Line 9: | Line 9: | ||
== Behind the Scenes == | == Behind the Scenes == | ||
− | System will parse list of | + | System will parse list of appointments and attempt to find existing records based on the id passed in. If no match is found and old id value is supplied, will also do an additional check for that identifier prior to inserting a new record. If a match is not found, a new contact is created with whatever information is supplied. |
Line 30: | Line 30: | ||
{{Core Method Header - CSharp}} | {{Core Method Header - CSharp}} | ||
− | {{Json | + | {{Json Appointments Block - CSharp}} |
{{Json Auth Block - Account - CSharp}} | {{Json Auth Block - Account - CSharp}} | ||
{{Core Method Footer - CSharp|syncAppointments|syncAppointments}} | {{Core Method Footer - CSharp|syncAppointments|syncAppointments}} | ||
Line 41: | Line 41: | ||
{{Talk To Updox - Core - Java|syncAppointments|syncAppointments}} | {{Talk To Updox - Core - Java|syncAppointments|syncAppointments}} | ||
− | {{Json | + | {{Json Appointments Block - Java}} |
{{Base_Code_for_Consuming_API_Using_Java}} | {{Base_Code_for_Consuming_API_Using_Java}} | ||
|} | |} | ||
− | |||
− | |||
== Messages == | == Messages == | ||
=== Destination Address === | === Destination Address === |
Latest revision as of 21:26, 11 December 2015
Contents |
Description
Method that allows the syncing of organization's patient appointments.
Behind the Scenes
System will parse list of appointments and attempt to find existing records based on the id passed in. If no match is found and old id value is supplied, will also do an additional check for that identifier prior to inserting a new record. If a match is not found, a new contact is created with whatever information is supplied.
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 { appointments = new[] { new { locationId = "123", cancelled = false, blocked = false, details = "details", summary = "summary", typeId = "456", patientId = "789", duration = 500, date = "2015-12-30", calendarId = "calendarId", updoxId = 6543, id = 3456 } }, auth = new { applicationId = "vendorId", applicationPassword = "vendorPassword", accountId = "accountId", userId = "" } }); string url = "https://updoxqa.com/io/syncAppointments"; 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/syncAppointments"; 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> appointment1 = new HashMap(); appointment1.put("locationId", "locationId"); appointment1.put("cancelled", false); appointment1.put("blocked", false); appointment1.put("details", "details"); appointment1.put("summary", "summary"); appointment1.put("typeId", "typeId"); appointment1.put("patientId", "patientId"); appointment1.put("duration", 500); appointment1.put("date", "2015-12-30"); appointment1.put("calendarId", "calendarId"); appointment1.put("updoxId", 123); appointment1.put("id", 234); List<String> appointments = new ArrayList<>(); appointments.add(appointment1); Map<String,Object> messageData = new HashMap(); messageData.put("appointments", appointments); 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
Destination Address
Request JSON
{ "appointments": [ { "locationId": "locationId", "cancelled": "true | false", "blocked": "true | false", "details": "details", "summary": "summary", "typeId": "typeId", "patientId": "patientId", "duration": "duration", "date": "date", "calendarId": "calendarId", "updoxId": "updoxId", "id": "id" } ], "auth": { "applicationId": "vendorId", "applicationPassword": "vendorPassword", "accountId": "accountId", "userId": "" } }
HTTP Response Status
200 OK
Response JSON
{ "successful": true, "responseMessage": "OK", "responseCode": 2000, "statuses": [ { "id": "id", "success": "true | false", "message": "message" } ] }