Xbase++
Xbase++
Bluzone Get Project Details
See more Bluzone Examples
Get a project by its idChilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL oSbResponseBody
LOCAL oJResp
LOCAL nRespStatusCode
LOCAL nProjectId
LOCAL cName
LOCAL cDescription
LOCAL cStatus
LOCAL cOwnerUsername
LOCAL cOwnerEmailAddress
LOCAL cDefaultUuidValue
LOCAL nEnableLocusMaps
LOCAL cMapProviderType
LOCAL nEnableAdvancedPackets
LOCAL cEnabledPacketTypes
LOCAL nEnableDataUnload
LOCAL nEnableScanConsumer
LOCAL nEnablePolicyConsumer
LOCAL nEnableLocationConsumer
LOCAL nEnableEmail
LOCAL cFirmwareUpdateStrategy
LOCAL nDeviceJobConcurrency
LOCAL cMapProviderApiKey
LOCAL cWakeupUuid
LOCAL cReportTimezone
LOCAL cLanguage
LOCAL cBlufiHostnameNaming
LOCAL nDateCreated
LOCAL nDateUpdated
LOCAL nEnableStreamProducer
LOCAL nEnableMetricStorage
LOCAL i
LOCAL nCount_i
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.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'
oHttp:SetRequestHeader("bzid", "YOUR_API_KEY_HERE")
oSbResponseBody := CreateObject("Chilkat.StringBuilder")
nSuccess := oHttp:QuickGetSb("https://bluzone.io/portal/papis/v1/projects/YOUR_PROJECT_ID_HERE/", oSbResponseBody)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oSbResponseBody:destroy()
RETURN
ENDIF
oJResp := CreateObject("Chilkat.JsonObject")
oJResp:LoadSb(oSbResponseBody)
oJResp:EmitCompact := 0
? "Response Body:"
? oJResp:Emit()
nRespStatusCode := oHttp:LastStatus
? "Response Status Code = " + Str(nRespStatusCode)
IF (nRespStatusCode >= 400)
? "Response Header:"
? oHttp:LastHeader
? "Failed."
oHttp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()
RETURN
ENDIF
// 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
nProjectId := oJResp:IntOf("projectId")
cName := oJResp:StringOf("name")
cDescription := oJResp:StringOf("description")
cStatus := oJResp:StringOf("status")
cOwnerUsername := oJResp:StringOf("owner.username")
cOwnerEmailAddress := oJResp:StringOf("owner.emailAddress")
cDefaultUuidValue := oJResp:StringOf("defaultUuidValue")
nEnableLocusMaps := oJResp:BoolOf("enableLocusMaps")
cMapProviderType := oJResp:StringOf("mapProviderType")
nEnableAdvancedPackets := oJResp:BoolOf("enableAdvancedPackets")
cEnabledPacketTypes := oJResp:StringOf("enabledPacketTypes")
nEnableDataUnload := oJResp:BoolOf("enableDataUnload")
nEnableScanConsumer := oJResp:BoolOf("enableScanConsumer")
nEnablePolicyConsumer := oJResp:BoolOf("enablePolicyConsumer")
nEnableLocationConsumer := oJResp:BoolOf("enableLocationConsumer")
nEnableEmail := oJResp:BoolOf("enableEmail")
cFirmwareUpdateStrategy := oJResp:StringOf("firmwareUpdateStrategy")
nDeviceJobConcurrency := oJResp:IntOf("deviceJobConcurrency")
cMapProviderApiKey := oJResp:StringOf("mapProviderApiKey")
cWakeupUuid := oJResp:StringOf("wakeupUuid")
cReportTimezone := oJResp:StringOf("reportTimezone")
cLanguage := oJResp:StringOf("language")
cBlufiHostnameNaming := oJResp:StringOf("blufiHostnameNaming")
nDateCreated := oJResp:IntOf("dateCreated")
nDateUpdated := oJResp:IntOf("dateUpdated")
nEnableStreamProducer := oJResp:BoolOf("enableStreamProducer")
nEnableMetricStorage := oJResp:BoolOf("enableMetricStorage")
i := 0
nCount_i := oJResp:SizeOfArray("reportEmailList")
DO WHILE i < nCount_i
oJResp:I := i
i := i + 1
ENDDO
oHttp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()