Created
April 19, 2018 17:55
-
-
Save jakeceballos/f181eeb0eae0a7f14307e5aad866af5d to your computer and use it in GitHub Desktop.
Mirth Connect - GET request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = new java.net.URL('https://api.athenahealth.com/v1/' + practiceId + '/patients?departmentid=' + departmentId + '&limit=' + limit + '&offset=' + offset + '&status=a'); | |
var conn = url.openConnection(); | |
conn.setRequestMethod('GET'); | |
conn.setRequestProperty('Authorization', 'Bearer ' + globalMap.get('Accesstoken')); | |
var inputStream = conn.getInputStream(); | |
var streamReader = new java.io.InputStreamReader(inputStream); | |
var respStream = new java.io.BufferedReader(streamReader); | |
var buffer = new java.lang.StringBuffer(); | |
var line = null; | |
while ((line = respStream.readLine()) != null) { | |
buffer.append(line + '\n'); | |
} | |
respStream.close(); | |
var responseObject = JSON.parse(buffer.toString()); | |
return responseObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jakeceballos were you ever able to deal with handling or writing more info in regards to errors ran into here? I've used the same approach, but when server gives a 500 for ANY reason, all we get is a "Wrapped java.io.IOException: Server returned HTTP response code: 500 for URL" that isn't very helpful...