(Java) Download Full Intake Form in JSON Format
The full intake form is very similar to intake summary object, except it adds an array of questions. For more information, see https://support.intakeq.com/article/31-intakeq-api#download-intake
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
// To log the exact HTTP request/response to a session log file:
http.put_SessionLogFilename("/someDir/sessionLog.txt");
http.SetRequestHeader("X-Auth-Key","xxxxxxxxxxxxxxxxxxxxxxxxx");
CkStringBuilder sbJson = new CkStringBuilder();
boolean success = http.QuickGetSb("https://intakeq.com/api/v1/intakes/[intake-id]",sbJson);
if (success == false) {
System.out.println(http.lastErrorText());
return;
}
if (http.get_LastStatus() != 200) {
System.out.println("status code: " + http.get_LastStatus());
System.out.println("response: " + sbJson.getAsString());
return;
}
System.out.println("raw response: ");
System.out.println(sbJson.getAsString());
CkJsonObject json = new CkJsonObject();
json.LoadSb(sbJson);
json.put_EmitCompact(true);
System.out.println(json.emit());
}
}
|