Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(C) Bluzone Get Project DetailsGet a project by its id For more information, see https://bluzone.io/portal/static/docs/index.html#_getprojectbyprojectid
#include <C_CkHttp.h> #include <C_CkStringBuilder.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { HCkHttp http; BOOL success; HCkStringBuilder sbResponseBody; HCkJsonObject jResp; int respStatusCode; int projectId; const char *name; const char *description; const char *status; const char *ownerUsername; const char *ownerEmailAddress; const char *defaultUuidValue; BOOL enableLocusMaps; const char *mapProviderType; BOOL enableAdvancedPackets; const char *enabledPacketTypes; BOOL enableDataUnload; BOOL enableScanConsumer; BOOL enablePolicyConsumer; BOOL enableLocationConsumer; BOOL enableEmail; const char *firmwareUpdateStrategy; int deviceJobConcurrency; const char *mapProviderApiKey; const char *wakeupUuid; const char *reportTimezone; const char *language; const char *blufiHostnameNaming; int dateCreated; int dateUpdated; BOOL enableStreamProducer; BOOL enableMetricStorage; int i; int count_i; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); // 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' CkHttp_SetRequestHeader(http,"bzid","YOUR_API_KEY_HERE"); sbResponseBody = CkStringBuilder_Create(); success = CkHttp_QuickGetSb(http,"https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/",sbResponseBody); if (success == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); return; } jResp = CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,FALSE); printf("Response Body:\n"); printf("%s\n",CkJsonObject_emit(jResp)); respStatusCode = CkHttp_getLastStatus(http); printf("Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { printf("Response Header:\n"); printf("%s\n",CkHttp_lastHeader(http)); printf("Failed.\n"); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); 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 projectId = CkJsonObject_IntOf(jResp,"projectId"); name = CkJsonObject_stringOf(jResp,"name"); description = CkJsonObject_stringOf(jResp,"description"); status = CkJsonObject_stringOf(jResp,"status"); ownerUsername = CkJsonObject_stringOf(jResp,"owner.username"); ownerEmailAddress = CkJsonObject_stringOf(jResp,"owner.emailAddress"); defaultUuidValue = CkJsonObject_stringOf(jResp,"defaultUuidValue"); enableLocusMaps = CkJsonObject_BoolOf(jResp,"enableLocusMaps"); mapProviderType = CkJsonObject_stringOf(jResp,"mapProviderType"); enableAdvancedPackets = CkJsonObject_BoolOf(jResp,"enableAdvancedPackets"); enabledPacketTypes = CkJsonObject_stringOf(jResp,"enabledPacketTypes"); enableDataUnload = CkJsonObject_BoolOf(jResp,"enableDataUnload"); enableScanConsumer = CkJsonObject_BoolOf(jResp,"enableScanConsumer"); enablePolicyConsumer = CkJsonObject_BoolOf(jResp,"enablePolicyConsumer"); enableLocationConsumer = CkJsonObject_BoolOf(jResp,"enableLocationConsumer"); enableEmail = CkJsonObject_BoolOf(jResp,"enableEmail"); firmwareUpdateStrategy = CkJsonObject_stringOf(jResp,"firmwareUpdateStrategy"); deviceJobConcurrency = CkJsonObject_IntOf(jResp,"deviceJobConcurrency"); mapProviderApiKey = CkJsonObject_stringOf(jResp,"mapProviderApiKey"); wakeupUuid = CkJsonObject_stringOf(jResp,"wakeupUuid"); reportTimezone = CkJsonObject_stringOf(jResp,"reportTimezone"); language = CkJsonObject_stringOf(jResp,"language"); blufiHostnameNaming = CkJsonObject_stringOf(jResp,"blufiHostnameNaming"); dateCreated = CkJsonObject_IntOf(jResp,"dateCreated"); dateUpdated = CkJsonObject_IntOf(jResp,"dateUpdated"); enableStreamProducer = CkJsonObject_BoolOf(jResp,"enableStreamProducer"); enableMetricStorage = CkJsonObject_BoolOf(jResp,"enableMetricStorage"); i = 0; count_i = CkJsonObject_SizeOfArray(jResp,"reportEmailList"); while (i < count_i) { CkJsonObject_putI(jResp,i); i = i + 1; } CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.