GetDevicePoolCompatibility Foxpro Example
LOCAL loRest
LOCAL lnSuccess
LOCAL loAuthAws
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
LOCAL loJResp
LOCAL lnCompatible
LOCAL lcArn
LOCAL lcAvailability
LOCAL lcCarrier
LOCAL lcArchitecture
LOCAL lnClock
LOCAL lcFrequency
LOCAL lcFleetName
LOCAL lcFleetType
LOCAL lcFormFactor
LOCAL lnHeapSize
LOCAL lcImage
LOCAL lcManufacturer
LOCAL lnMemory
LOCAL lcModel
LOCAL lcModelId
LOCAL lcName
LOCAL lcOs
LOCAL lcPlatform
LOCAL lcRadio
LOCAL lnRemoteAccessEnabled
LOCAL lnRemoteDebugEnabled
LOCAL lnHeight
LOCAL lnWidth
LOCAL j
LOCAL lnCount_j
LOCAL lcArn
LOCAL lcDeviceArn
LOCAL lcInstanceProfileArn
LOCAL lcDescription
LOCAL lcInstanceProfileName
LOCAL lnPackageCleanup
LOCAL lnRebootAfterUse
LOCAL lcStatus
LOCAL lcUdid
LOCAL k
LOCAL lnCount_k
LOCAL lcStrVal
LOCAL lcMessage
LOCAL lcV_type
LOCAL lcDeviceAvailability
LOCAL lcDeviceCarrier
LOCAL lcCpuArchitecture
LOCAL lnCpuClock
LOCAL lcCpuFrequency
LOCAL lcDeviceFleetName
LOCAL lcDeviceFleetType
LOCAL lcDeviceFormFactor
LOCAL lnDeviceHeapSize
LOCAL lcDeviceImage
LOCAL lcDeviceManufacturer
LOCAL lnDeviceMemory
LOCAL lcDeviceModel
LOCAL lcDeviceModelId
LOCAL lcDeviceName
LOCAL lcDeviceOs
LOCAL lcDevicePlatform
LOCAL lcDeviceRadio
LOCAL lnDeviceRemoteAccessEnabled
LOCAL lnDeviceRemoteDebugEnabled
LOCAL lnResolutionHeight
LOCAL lnResolutionWidth
LOCAL lcInstanceProfileDescription
LOCAL lnInstanceProfilePackageCleanup
LOCAL lnInstanceProfileRebootAfterUse
LOCAL i
LOCAL lnCount_i
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loRest = CreateObject('Chilkat_9_5_0.Rest')
loAuthAws = CreateObject('Chilkat_9_5_0.AuthAws')
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.SecretKey = "AWS_SECRET_KEY"
* Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
loAuthAws.Region = "us-west-2"
loAuthAws.ServiceName = "devicefarm"
* SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
loRest.SetAuthAws(loAuthAws)
* URL: https://devicefarm.us-west-2.amazonaws.com/
* Use the same region as specified above.
lnSuccess = loRest.Connect("devicefarm.us-west-2.amazonaws.com",443,1,1)
IF (lnSuccess <> 1) THEN
? "ConnectFailReason: " + STR(loRest.ConnectFailReason)
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
CANCEL
ENDIF
* The following code creates the JSON request body.
* The JSON created by this code is shown below.
* Use this online tool to generate code from sample JSON:
* Generate Code to Create JSON
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("appArn","string")
loJson.UpdateString("configuration.auxiliaryApps[0]","string")
loJson.UpdateString("configuration.billingMethod","string")
loJson.UpdateString("configuration.customerArtifactPaths.androidPaths[0]","string")
loJson.UpdateString("configuration.customerArtifactPaths.deviceHostPaths[0]","string")
loJson.UpdateString("configuration.customerArtifactPaths.iosPaths[0]","string")
loJson.UpdateString("configuration.extraDataPackageArn","string")
loJson.UpdateString("configuration.locale","string")
loJson.UpdateInt("configuration.location.latitude",123)
loJson.UpdateInt("configuration.location.longitude",123)
loJson.UpdateString("configuration.networkProfileArn","string")
loJson.UpdateInt("configuration.radios.bluetooth",123)
loJson.UpdateInt("configuration.radios.gps",123)
loJson.UpdateInt("configuration.radios.nfc",123)
loJson.UpdateInt("configuration.radios.wifi",123)
loJson.UpdateString("configuration.vpceConfigurationArns[0]","string")
loJson.UpdateString("devicePoolArn","string")
loJson.UpdateString("test.filter","string")
loJson.UpdateString("test.parameters.string","string")
loJson.UpdateString("test.testPackageArn","string")
loJson.UpdateString("test.testSpecArn","string")
loJson.UpdateString("test.type","string")
loJson.UpdateString("testType","string")
* The JSON request body created by the above code:
* {
* "appArn": "string",
* "configuration": {
* "auxiliaryApps": [
* "string"
* ],
* "billingMethod": "string",
* "customerArtifactPaths": {
* "androidPaths": [
* "string"
* ],
* "deviceHostPaths": [
* "string"
* ],
* "iosPaths": [
* "string"
* ]
* },
* "extraDataPackageArn": "string",
* "locale": "string",
* "location": {
* "latitude": number,
* "longitude": number
* },
* "networkProfileArn": "string",
* "radios": {
* "bluetooth": boolean,
* "gps": boolean,
* "nfc": boolean,
* "wifi": boolean
* },
* "vpceConfigurationArns": [
* "string"
* ]
* },
* "devicePoolArn": "string",
* "test": {
* "filter": "string",
* "parameters": {
* "string": "string"
* },
* "testPackageArn": "string",
* "testSpecArn": "string",
* "type": "string"
* },
* "testType": "string"
* }
loRest.AddHeader("Content-Type","application/x-amz-json-1.1")
loRest.AddHeader("X-Amz-Target","DeviceFarm_20150623.GetDevicePoolCompatibility")
loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestSb("POST","/",loSbRequestBody,loSbResponseBody)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
lnRespStatusCode = loRest.ResponseStatusCode
? "response status code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode <> 200) THEN
? "Response Header:"
? loRest.ResponseHeader
? "Response Body:"
? loSbResponseBody.GetAsString()
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
CANCEL
ENDIF
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
* The following code parses the JSON response.
* A sample JSON response is shown below the sample code.
* Use this online tool to generate parsing code from sample JSON:
* Generate Parsing Code from JSON
i = 0
lnCount_i = loJResp.SizeOfArray("compatibleDevices")
DO WHILE i < lnCount_i
loJResp.I = i
lnCompatible = loJResp.IntOf("compatibleDevices[i].compatible")
lcArn = loJResp.StringOf("compatibleDevices[i].device.arn")
lcAvailability = loJResp.StringOf("compatibleDevices[i].device.availability")
lcCarrier = loJResp.StringOf("compatibleDevices[i].device.carrier")
lcArchitecture = loJResp.StringOf("compatibleDevices[i].device.cpu.architecture")
lnClock = loJResp.IntOf("compatibleDevices[i].device.cpu.clock")
lcFrequency = loJResp.StringOf("compatibleDevices[i].device.cpu.frequency")
lcFleetName = loJResp.StringOf("compatibleDevices[i].device.fleetName")
lcFleetType = loJResp.StringOf("compatibleDevices[i].device.fleetType")
lcFormFactor = loJResp.StringOf("compatibleDevices[i].device.formFactor")
lnHeapSize = loJResp.IntOf("compatibleDevices[i].device.heapSize")
lcImage = loJResp.StringOf("compatibleDevices[i].device.image")
lcManufacturer = loJResp.StringOf("compatibleDevices[i].device.manufacturer")
lnMemory = loJResp.IntOf("compatibleDevices[i].device.memory")
lcModel = loJResp.StringOf("compatibleDevices[i].device.model")
lcModelId = loJResp.StringOf("compatibleDevices[i].device.modelId")
lcName = loJResp.StringOf("compatibleDevices[i].device.name")
lcOs = loJResp.StringOf("compatibleDevices[i].device.os")
lcPlatform = loJResp.StringOf("compatibleDevices[i].device.platform")
lcRadio = loJResp.StringOf("compatibleDevices[i].device.radio")
lnRemoteAccessEnabled = loJResp.IntOf("compatibleDevices[i].device.remoteAccessEnabled")
lnRemoteDebugEnabled = loJResp.IntOf("compatibleDevices[i].device.remoteDebugEnabled")
lnHeight = loJResp.IntOf("compatibleDevices[i].device.resolution.height")
lnWidth = loJResp.IntOf("compatibleDevices[i].device.resolution.width")
j = 0
lnCount_j = loJResp.SizeOfArray("compatibleDevices[i].device.instances")
DO WHILE j < lnCount_j
loJResp.J = j
lcArn = loJResp.StringOf("compatibleDevices[i].device.instances[j].arn")
lcDeviceArn = loJResp.StringOf("compatibleDevices[i].device.instances[j].deviceArn")
lcInstanceProfileArn = loJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.arn")
lcDescription = loJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.description")
lcInstanceProfileName = loJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.name")
lnPackageCleanup = loJResp.IntOf("compatibleDevices[i].device.instances[j].instanceProfile.packageCleanup")
lnRebootAfterUse = loJResp.IntOf("compatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse")
lcStatus = loJResp.StringOf("compatibleDevices[i].device.instances[j].status")
lcUdid = loJResp.StringOf("compatibleDevices[i].device.instances[j].udid")
k = 0
lnCount_k = loJResp.SizeOfArray("compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]")
k = k + 1
ENDDO
k = 0
lnCount_k = loJResp.SizeOfArray("compatibleDevices[i].device.instances[j].labels")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("compatibleDevices[i].device.instances[j].labels[k]")
k = k + 1
ENDDO
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("compatibleDevices[i].incompatibilityMessages")
DO WHILE j < lnCount_j
loJResp.J = j
lcMessage = loJResp.StringOf("compatibleDevices[i].incompatibilityMessages[j].message")
lcV_type = loJResp.StringOf("compatibleDevices[i].incompatibilityMessages[j].type")
j = j + 1
ENDDO
i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("incompatibleDevices")
DO WHILE i < lnCount_i
loJResp.I = i
lnCompatible = loJResp.IntOf("incompatibleDevices[i].compatible")
lcDeviceArn = loJResp.StringOf("incompatibleDevices[i].device.arn")
lcDeviceAvailability = loJResp.StringOf("incompatibleDevices[i].device.availability")
lcDeviceCarrier = loJResp.StringOf("incompatibleDevices[i].device.carrier")
lcCpuArchitecture = loJResp.StringOf("incompatibleDevices[i].device.cpu.architecture")
lnCpuClock = loJResp.IntOf("incompatibleDevices[i].device.cpu.clock")
lcCpuFrequency = loJResp.StringOf("incompatibleDevices[i].device.cpu.frequency")
lcDeviceFleetName = loJResp.StringOf("incompatibleDevices[i].device.fleetName")
lcDeviceFleetType = loJResp.StringOf("incompatibleDevices[i].device.fleetType")
lcDeviceFormFactor = loJResp.StringOf("incompatibleDevices[i].device.formFactor")
lnDeviceHeapSize = loJResp.IntOf("incompatibleDevices[i].device.heapSize")
lcDeviceImage = loJResp.StringOf("incompatibleDevices[i].device.image")
lcDeviceManufacturer = loJResp.StringOf("incompatibleDevices[i].device.manufacturer")
lnDeviceMemory = loJResp.IntOf("incompatibleDevices[i].device.memory")
lcDeviceModel = loJResp.StringOf("incompatibleDevices[i].device.model")
lcDeviceModelId = loJResp.StringOf("incompatibleDevices[i].device.modelId")
lcDeviceName = loJResp.StringOf("incompatibleDevices[i].device.name")
lcDeviceOs = loJResp.StringOf("incompatibleDevices[i].device.os")
lcDevicePlatform = loJResp.StringOf("incompatibleDevices[i].device.platform")
lcDeviceRadio = loJResp.StringOf("incompatibleDevices[i].device.radio")
lnDeviceRemoteAccessEnabled = loJResp.IntOf("incompatibleDevices[i].device.remoteAccessEnabled")
lnDeviceRemoteDebugEnabled = loJResp.IntOf("incompatibleDevices[i].device.remoteDebugEnabled")
lnResolutionHeight = loJResp.IntOf("incompatibleDevices[i].device.resolution.height")
lnResolutionWidth = loJResp.IntOf("incompatibleDevices[i].device.resolution.width")
j = 0
lnCount_j = loJResp.SizeOfArray("incompatibleDevices[i].device.instances")
DO WHILE j < lnCount_j
loJResp.J = j
lcArn = loJResp.StringOf("incompatibleDevices[i].device.instances[j].arn")
lcDeviceArn = loJResp.StringOf("incompatibleDevices[i].device.instances[j].deviceArn")
lcInstanceProfileArn = loJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.arn")
lcInstanceProfileDescription = loJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.description")
lcInstanceProfileName = loJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.name")
lnInstanceProfilePackageCleanup = loJResp.IntOf("incompatibleDevices[i].device.instances[j].instanceProfile.packageCleanup")
lnInstanceProfileRebootAfterUse = loJResp.IntOf("incompatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse")
lcStatus = loJResp.StringOf("incompatibleDevices[i].device.instances[j].status")
lcUdid = loJResp.StringOf("incompatibleDevices[i].device.instances[j].udid")
k = 0
lnCount_k = loJResp.SizeOfArray("incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]")
k = k + 1
ENDDO
k = 0
lnCount_k = loJResp.SizeOfArray("incompatibleDevices[i].device.instances[j].labels")
DO WHILE k < lnCount_k
loJResp.K = k
lcStrVal = loJResp.StringOf("incompatibleDevices[i].device.instances[j].labels[k]")
k = k + 1
ENDDO
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("incompatibleDevices[i].incompatibilityMessages")
DO WHILE j < lnCount_j
loJResp.J = j
lcMessage = loJResp.StringOf("incompatibleDevices[i].incompatibilityMessages[j].message")
lcV_type = loJResp.StringOf("incompatibleDevices[i].incompatibilityMessages[j].type")
j = j + 1
ENDDO
i = i + 1
ENDDO
* A sample JSON response body parsed by the above code:
* {
* "compatibleDevices": [
* {
* "compatible": boolean,
* "device": {
* "arn": "string",
* "availability": "string",
* "carrier": "string",
* "cpu": {
* "architecture": "string",
* "clock": number,
* "frequency": "string"
* },
* "fleetName": "string",
* "fleetType": "string",
* "formFactor": "string",
* "heapSize": number,
* "image": "string",
* "instances": [
* {
* "arn": "string",
* "deviceArn": "string",
* "instanceProfile": {
* "arn": "string",
* "description": "string",
* "excludeAppPackagesFromCleanup": [
* "string"
* ],
* "name": "string",
* "packageCleanup": boolean,
* "rebootAfterUse": boolean
* },
* "labels": [
* "string"
* ],
* "status": "string",
* "udid": "string"
* }
* ],
* "manufacturer": "string",
* "memory": number,
* "model": "string",
* "modelId": "string",
* "name": "string",
* "os": "string",
* "platform": "string",
* "radio": "string",
* "remoteAccessEnabled": boolean,
* "remoteDebugEnabled": boolean,
* "resolution": {
* "height": number,
* "width": number
* }
* },
* "incompatibilityMessages": [
* {
* "message": "string",
* "type": "string"
* }
* ]
* }
* ],
* "incompatibleDevices": [
* {
* "compatible": boolean,
* "device": {
* "arn": "string",
* "availability": "string",
* "carrier": "string",
* "cpu": {
* "architecture": "string",
* "clock": number,
* "frequency": "string"
* },
* "fleetName": "string",
* "fleetType": "string",
* "formFactor": "string",
* "heapSize": number,
* "image": "string",
* "instances": [
* {
* "arn": "string",
* "deviceArn": "string",
* "instanceProfile": {
* "arn": "string",
* "description": "string",
* "excludeAppPackagesFromCleanup": [
* "string"
* ],
* "name": "string",
* "packageCleanup": boolean,
* "rebootAfterUse": boolean
* },
* "labels": [
* "string"
* ],
* "status": "string",
* "udid": "string"
* }
* ],
* "manufacturer": "string",
* "memory": number,
* "model": "string",
* "modelId": "string",
* "name": "string",
* "os": "string",
* "platform": "string",
* "radio": "string",
* "remoteAccessEnabled": boolean,
* "remoteDebugEnabled": boolean,
* "resolution": {
* "height": number,
* "width": number
* }
* },
* "incompatibilityMessages": [
* {
* "message": "string",
* "type": "string"
* }
* ]
* }
* ]
* }
RELEASE loRest
RELEASE loAuthAws
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJResp