(Swift 2) 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
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()
// To log the exact HTTP request/response to a session log file:
http.SessionLogFilename = "/someDir/sessionLog.txt"
http.SetRequestHeader("X-Auth-Key", value: "xxxxxxxxxxxxxxxxxxxxxxxxx")
let sbJson = CkoStringBuilder()
var success: Bool = http.QuickGetSb("https://intakeq.com/api/v1/intakes/[intake-id]", sbContent: sbJson)
if success == false {
print("\(http.LastErrorText)")
return
}
if http.LastStatus.intValue != 200 {
print("status code: \(http.LastStatus.intValue)")
print("response: \(sbJson.GetAsString())")
return
}
print("raw response: ")
print("\(sbJson.GetAsString())")
let json = CkoJsonObject()
json.LoadSb(sbJson)
json.EmitCompact = true
print("\(json.Emit())")
}
|