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