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
(Swift 3,4,5...) Bluzone Get Project DetailsGet a project by its id For more information, see https://bluzone.io/portal/static/docs/index.html#_getprojectbyprojectid
func chilkatTest() { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! var success: Bool // 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("bzid", value: "YOUR_API_KEY_HERE") let sbResponseBody = CkoStringBuilder()! success = http.quickGetSb("https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/", sbContent: sbResponseBody) if success == false { print("\(http.lastErrorText!)") return } let jResp = CkoJsonObject()! jResp.loadSb(sbResponseBody) jResp.emitCompact = false print("Response Body:") print("\(jResp.emit()!)") var respStatusCode: Int = http.lastStatus.intValue print("Response Status Code = \(respStatusCode)") if respStatusCode >= 400 { print("Response Header:") print("\(http.lastHeader!)") print("Failed.") 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 var projectId: Int var name: String? var description: String? var status: String? var ownerUsername: String? var ownerEmailAddress: String? var defaultUuidValue: String? var enableLocusMaps: Bool var mapProviderType: String? var enableAdvancedPackets: Bool var enabledPacketTypes: String? var enableDataUnload: Bool var enableScanConsumer: Bool var enablePolicyConsumer: Bool var enableLocationConsumer: Bool var enableEmail: Bool var firmwareUpdateStrategy: String? var deviceJobConcurrency: Int var mapProviderApiKey: String? var wakeupUuid: String? var reportTimezone: String? var language: String? var blufiHostnameNaming: String? var dateCreated: Int var dateUpdated: Int var enableStreamProducer: Bool var enableMetricStorage: Bool var i: Int var count_i: Int projectId = jResp.int(of: "projectId").intValue name = jResp.string(of: "name") description = jResp.string(of: "description") status = jResp.string(of: "status") ownerUsername = jResp.string(of: "owner.username") ownerEmailAddress = jResp.string(of: "owner.emailAddress") defaultUuidValue = jResp.string(of: "defaultUuidValue") enableLocusMaps = jResp.bool(of: "enableLocusMaps") mapProviderType = jResp.string(of: "mapProviderType") enableAdvancedPackets = jResp.bool(of: "enableAdvancedPackets") enabledPacketTypes = jResp.string(of: "enabledPacketTypes") enableDataUnload = jResp.bool(of: "enableDataUnload") enableScanConsumer = jResp.bool(of: "enableScanConsumer") enablePolicyConsumer = jResp.bool(of: "enablePolicyConsumer") enableLocationConsumer = jResp.bool(of: "enableLocationConsumer") enableEmail = jResp.bool(of: "enableEmail") firmwareUpdateStrategy = jResp.string(of: "firmwareUpdateStrategy") deviceJobConcurrency = jResp.int(of: "deviceJobConcurrency").intValue mapProviderApiKey = jResp.string(of: "mapProviderApiKey") wakeupUuid = jResp.string(of: "wakeupUuid") reportTimezone = jResp.string(of: "reportTimezone") language = jResp.string(of: "language") blufiHostnameNaming = jResp.string(of: "blufiHostnameNaming") dateCreated = jResp.int(of: "dateCreated").intValue dateUpdated = jResp.int(of: "dateUpdated").intValue enableStreamProducer = jResp.bool(of: "enableStreamProducer") enableMetricStorage = jResp.bool(of: "enableMetricStorage") i = 0 count_i = jResp.size(ofArray: "reportEmailList").intValue while i < count_i { jResp.i = i i = i + 1 } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.