(Objective-C) 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 <CkoHttp.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
// To log the exact HTTP request/response to a session log file:
http.SessionLogFilename = @"/someDir/sessionLog.txt";
[http SetRequestHeader: @"X-Auth-Key" value: @"xxxxxxxxxxxxxxxxxxxxxxxxx"];
CkoStringBuilder *sbJson = [[CkoStringBuilder alloc] init];
BOOL success = [http QuickGetSb: @"https://intakeq.com/api/v1/intakes/[intake-id]" sbContent: sbJson];
if (success == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
if ([http.LastStatus intValue] != 200) {
NSLog(@"%@%d",@"status code: ",[http.LastStatus intValue]);
NSLog(@"%@%@",@"response: ",[sbJson GetAsString]);
return;
}
NSLog(@"%@",@"raw response: ");
NSLog(@"%@",[sbJson GetAsString]);
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json LoadSb: sbJson];
json.EmitCompact = YES;
NSLog(@"%@",[json Emit]);
|