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
(Delphi DLL) Bluzone Get Project DetailsGet a project by its id For more information, see https://bluzone.io/portal/static/docs/index.html#_getprojectbyprojectid
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, StringBuilder, JsonObject; ... procedure TForm1.Button1Click(Sender: TObject); var http: HCkHttp; success: Boolean; sbResponseBody: HCkStringBuilder; jResp: HCkJsonObject; respStatusCode: Integer; projectId: Integer; name: PWideChar; description: PWideChar; status: PWideChar; ownerUsername: PWideChar; ownerEmailAddress: PWideChar; defaultUuidValue: PWideChar; enableLocusMaps: Boolean; mapProviderType: PWideChar; enableAdvancedPackets: Boolean; enabledPacketTypes: PWideChar; enableDataUnload: Boolean; enableScanConsumer: Boolean; enablePolicyConsumer: Boolean; enableLocationConsumer: Boolean; enableEmail: Boolean; firmwareUpdateStrategy: PWideChar; deviceJobConcurrency: Integer; mapProviderApiKey: PWideChar; wakeupUuid: PWideChar; reportTimezone: PWideChar; language: PWideChar; blufiHostnameNaming: PWideChar; dateCreated: Integer; dateUpdated: Integer; enableStreamProducer: Boolean; enableMetricStorage: Boolean; i: Integer; count_i: Integer; begin // 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) then begin Memo1.Lines.Add(CkHttp__lastErrorText(http)); Exit; end; jResp := CkJsonObject_Create(); CkJsonObject_LoadSb(jResp,sbResponseBody); CkJsonObject_putEmitCompact(jResp,False); Memo1.Lines.Add('Response Body:'); Memo1.Lines.Add(CkJsonObject__emit(jResp)); respStatusCode := CkHttp_getLastStatus(http); Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode)); if (respStatusCode >= 400) then begin Memo1.Lines.Add('Response Header:'); Memo1.Lines.Add(CkHttp__lastHeader(http)); Memo1.Lines.Add('Failed.'); Exit; end; // 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 do begin CkJsonObject_putI(jResp,i); i := i + 1; end; CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(jResp); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.