(Tcl) 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
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# To log the exact HTTP request/response to a session log file:
CkHttp_put_SessionLogFilename $http "/someDir/sessionLog.txt"
CkHttp_SetRequestHeader $http "X-Auth-Key" "xxxxxxxxxxxxxxxxxxxxxxxxx"
set sbJson [new_CkStringBuilder]
set success [CkHttp_QuickGetSb $http "https://intakeq.com/api/v1/intakes/[intake-id]" $sbJson]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkStringBuilder $sbJson
exit
}
if {[CkHttp_get_LastStatus $http] != 200} then {
puts "status code: [CkHttp_get_LastStatus $http]"
puts "response: [CkStringBuilder_getAsString $sbJson]"
delete_CkHttp $http
delete_CkStringBuilder $sbJson
exit
}
puts "raw response: "
puts [CkStringBuilder_getAsString $sbJson]
set json [new_CkJsonObject]
CkJsonObject_LoadSb $json $sbJson
CkJsonObject_put_EmitCompact $json 1
puts [CkJsonObject_emit $json]
delete_CkHttp $http
delete_CkStringBuilder $sbJson
delete_CkJsonObject $json
|