Unicode C++
Unicode C++
Bluzone Get Project Details
See more Bluzone Examples
Get a project by its idChilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// Implements the following CURL command:
// curl -X GET \
// https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/ \
// -H 'bzid: YOUR_API_KEY_HERE'
http.SetRequestHeader(L"bzid",L"YOUR_API_KEY_HERE");
CkStringBuilderW sbResponseBody;
success = http.QuickGetSb(L"https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/",sbResponseBody);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
CkJsonObjectW jResp;
jResp.LoadSb(sbResponseBody);
jResp.put_EmitCompact(false);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",jResp.emit());
int respStatusCode = http.get_LastStatus();
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",http.lastHeader());
wprintf(L"Failed.\n");
return;
}
// Sample JSON response:
// {
// "projectId": 36845,
// "name": "My Project",
// "description": "Default Project for admin@chilkatsoft.com, created on Thu Jun 06 17:18:11 GMT 2019.",
// "status": null,
// "owner": {
// "username": "admin@chilkatsoft.com",
// "emailAddress": null
// },
// "defaultUuidValue": "1b4b243c-59aa-405f-90b5-0c434cac1345",
// "enableLocusMaps": false,
// "mapProviderType": "GOOGLE",
// "enableAdvancedPackets": false,
// "enabledPacketTypes": "sBv2",
// "enableDataUnload": false,
// "enableScanConsumer": false,
// "enablePolicyConsumer": false,
// "enableLocationConsumer": false,
// "enableEmail": true,
// "firmwareUpdateStrategy": "MANUAL",
// "deviceJobConcurrency": -1,
// "mapProviderApiKey": null,
// "wakeupUuid": null,
// "reportEmailList": [
// ],
// "reportTimezone": "Etc/GMT",
// "language": "en",
// "blufiHostnameNaming": "DEFAULT",
// "dateCreated": 1559841491000,
// "dateUpdated": 1559841491000,
// "enableStreamProducer": true,
// "enableMetricStorage": true
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
int projectId;
const wchar_t *name = 0;
const wchar_t *description = 0;
const wchar_t *status = 0;
const wchar_t *ownerUsername = 0;
const wchar_t *ownerEmailAddress = 0;
const wchar_t *defaultUuidValue = 0;
bool enableLocusMaps;
const wchar_t *mapProviderType = 0;
bool enableAdvancedPackets;
const wchar_t *enabledPacketTypes = 0;
bool enableDataUnload;
bool enableScanConsumer;
bool enablePolicyConsumer;
bool enableLocationConsumer;
bool enableEmail;
const wchar_t *firmwareUpdateStrategy = 0;
int deviceJobConcurrency;
const wchar_t *mapProviderApiKey = 0;
const wchar_t *wakeupUuid = 0;
const wchar_t *reportTimezone = 0;
const wchar_t *language = 0;
const wchar_t *blufiHostnameNaming = 0;
int dateCreated;
int dateUpdated;
bool enableStreamProducer;
bool enableMetricStorage;
int i;
int count_i;
projectId = jResp.IntOf(L"projectId");
name = jResp.stringOf(L"name");
description = jResp.stringOf(L"description");
status = jResp.stringOf(L"status");
ownerUsername = jResp.stringOf(L"owner.username");
ownerEmailAddress = jResp.stringOf(L"owner.emailAddress");
defaultUuidValue = jResp.stringOf(L"defaultUuidValue");
enableLocusMaps = jResp.BoolOf(L"enableLocusMaps");
mapProviderType = jResp.stringOf(L"mapProviderType");
enableAdvancedPackets = jResp.BoolOf(L"enableAdvancedPackets");
enabledPacketTypes = jResp.stringOf(L"enabledPacketTypes");
enableDataUnload = jResp.BoolOf(L"enableDataUnload");
enableScanConsumer = jResp.BoolOf(L"enableScanConsumer");
enablePolicyConsumer = jResp.BoolOf(L"enablePolicyConsumer");
enableLocationConsumer = jResp.BoolOf(L"enableLocationConsumer");
enableEmail = jResp.BoolOf(L"enableEmail");
firmwareUpdateStrategy = jResp.stringOf(L"firmwareUpdateStrategy");
deviceJobConcurrency = jResp.IntOf(L"deviceJobConcurrency");
mapProviderApiKey = jResp.stringOf(L"mapProviderApiKey");
wakeupUuid = jResp.stringOf(L"wakeupUuid");
reportTimezone = jResp.stringOf(L"reportTimezone");
language = jResp.stringOf(L"language");
blufiHostnameNaming = jResp.stringOf(L"blufiHostnameNaming");
dateCreated = jResp.IntOf(L"dateCreated");
dateUpdated = jResp.IntOf(L"dateUpdated");
enableStreamProducer = jResp.BoolOf(L"enableStreamProducer");
enableMetricStorage = jResp.BoolOf(L"enableMetricStorage");
i = 0;
count_i = jResp.SizeOfArray(L"reportEmailList");
while (i < count_i) {
jResp.put_I(i);
i = i + 1;
}
}