(Unicode 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
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// To log the exact HTTP request/response to a session log file:
http.put_SessionLogFilename(L"/someDir/sessionLog.txt");
http.SetRequestHeader(L"X-Auth-Key",L"xxxxxxxxxxxxxxxxxxxxxxxxx");
CkStringBuilderW sbJson;
bool success = http.QuickGetSb(L"https://intakeq.com/api/v1/intakes/[intake-id]",sbJson);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
if (http.get_LastStatus() != 200) {
wprintf(L"status code: %d\n",http.get_LastStatus());
wprintf(L"response: %s\n",sbJson.getAsString());
return;
}
wprintf(L"raw response: \n");
wprintf(L"%s\n",sbJson.getAsString());
CkJsonObjectW json;
json.LoadSb(sbJson);
json.put_EmitCompact(true);
wprintf(L"%s\n",json.emit());
}
|