Dart
Dart
Bluzone Get Project Details
See more Bluzone Examples
Get a project by its idChilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
// 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', 'YOUR_API_KEY_HERE');
final sbResponseBody = CkStringBuilder();
try {
http.quickGetSb('https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/', sbResponseBody);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final jResp = CkJsonObject();
jResp.loadSb(sbResponseBody);
jResp.emitCompact = false;
print('Response Body:');
print(jResp.emit());
final respStatusCode = http.lastStatus;
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 i = 0;
final projectId = jResp.intOf('projectId');
final name = jResp.stringOf('name');
final description = jResp.stringOf('description');
final status = jResp.stringOf('status');
final ownerUsername = jResp.stringOf('owner.username');
final ownerEmailAddress = jResp.stringOf('owner.emailAddress');
final defaultUuidValue = jResp.stringOf('defaultUuidValue');
final mapProviderType = jResp.stringOf('mapProviderType');
final enabledPacketTypes = jResp.stringOf('enabledPacketTypes');
final firmwareUpdateStrategy = jResp.stringOf('firmwareUpdateStrategy');
final deviceJobConcurrency = jResp.intOf('deviceJobConcurrency');
final mapProviderApiKey = jResp.stringOf('mapProviderApiKey');
final wakeupUuid = jResp.stringOf('wakeupUuid');
final reportTimezone = jResp.stringOf('reportTimezone');
final language = jResp.stringOf('language');
final blufiHostnameNaming = jResp.stringOf('blufiHostnameNaming');
final dateCreated = jResp.intOf('dateCreated');
final dateUpdated = jResp.intOf('dateUpdated');
i = 0;
final countI = jResp.sizeOfArray('reportEmailList');
while (i < countI) {
jResp.i = i;
i++;
}
}