(Swift 3,4,5...) 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()!)")
}
|