Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Download Full Intake Form in JSON Format
See more IntakeQ Examples
The full intake form is very similar to intake summary object, except it adds an array of questions.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Http,
Chilkat.StringBuilder,
Chilkat.JsonObject;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
http: THttp;
sbJson: TStringBuilder;
json: TJsonObject;
begin
success := False;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := THttp.Create;
// To log the exact HTTP request/response to a session log file:
http.SessionLogFilename := '/someDir/sessionLog.txt';
http.SetRequestHeader('X-Auth-Key','xxxxxxxxxxxxxxxxxxxxxxxxx');
sbJson := TStringBuilder.Create;
success := http.QuickGetSb('https://intakeq.com/api/v1/intakes/[intake-id]',sbJson);
if (success = False) then
begin
WriteLn(http.LastErrorText);
Exit;
end;
if (http.LastStatus <> 200) then
begin
WriteLn('status code: ' + http.LastStatus);
WriteLn('response: ' + sbJson.GetAsString());
Exit;
end;
WriteLn('raw response: ');
WriteLn(sbJson.GetAsString());
json := TJsonObject.Create;
json.LoadSb(sbJson);
json.EmitCompact := True;
WriteLn(json.Emit());
http.Free;
sbJson.Free;
json.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.