Chilkat Online Tools

GetDevicePoolCompatibility autoit Example

AWS Device Farm

; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oRest = ObjCreate("Chilkat_9_5_0.Rest")
Local $bSuccess

$oAuthAws = ObjCreate("Chilkat_9_5_0.AuthAws")
$oAuthAws.AccessKey = "AWS_ACCESS_KEY"
$oAuthAws.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.)
$oAuthAws.Region = "us-west-2"
$oAuthAws.ServiceName = "devicefarm"
; SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
$oRest.SetAuthAws($oAuthAws)

; URL: https://devicefarm.us-west-2.amazonaws.com/
; Use the same region as specified above.
$bSuccess = $oRest.Connect("devicefarm.us-west-2.amazonaws.com",443,True,True)
If ($bSuccess <> True) Then
    ConsoleWrite("ConnectFailReason: " & $oRest.ConnectFailReason & @CRLF)
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
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

$oJson = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJson.UpdateString("appArn","string")
$oJson.UpdateString("configuration.auxiliaryApps[0]","string")
$oJson.UpdateString("configuration.billingMethod","string")
$oJson.UpdateString("configuration.customerArtifactPaths.androidPaths[0]","string")
$oJson.UpdateString("configuration.customerArtifactPaths.deviceHostPaths[0]","string")
$oJson.UpdateString("configuration.customerArtifactPaths.iosPaths[0]","string")
$oJson.UpdateString("configuration.extraDataPackageArn","string")
$oJson.UpdateString("configuration.locale","string")
$oJson.UpdateInt("configuration.location.latitude",123)
$oJson.UpdateInt("configuration.location.longitude",123)
$oJson.UpdateString("configuration.networkProfileArn","string")
$oJson.UpdateInt("configuration.radios.bluetooth",123)
$oJson.UpdateInt("configuration.radios.gps",123)
$oJson.UpdateInt("configuration.radios.nfc",123)
$oJson.UpdateInt("configuration.radios.wifi",123)
$oJson.UpdateString("configuration.vpceConfigurationArns[0]","string")
$oJson.UpdateString("devicePoolArn","string")
$oJson.UpdateString("test.filter","string")
$oJson.UpdateString("test.parameters.string","string")
$oJson.UpdateString("test.testPackageArn","string")
$oJson.UpdateString("test.testSpecArn","string")
$oJson.UpdateString("test.type","string")
$oJson.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"
; }

$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","DeviceFarm_20150623.GetDevicePoolCompatibility")

$oSbRequestBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oJson.EmitSb($oSbRequestBody)
$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oRest.FullRequestSb("POST","/",$oSbRequestBody,$oSbResponseBody)
If ($bSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

Local $iRespStatusCode = $oRest.ResponseStatusCode
ConsoleWrite("response status code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode <> 200) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oRest.ResponseHeader & @CRLF)
    ConsoleWrite("Response Body:" & @CRLF)
    ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)
    Exit
EndIf

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)

; 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

Local $iCompatible
Local $sArn
Local $sAvailability
Local $sCarrier
Local $sArchitecture
Local $iClock
Local $sFrequency
Local $sFleetName
Local $sFleetType
Local $sFormFactor
Local $iHeapSize
Local $sImage
Local $sManufacturer
Local $iMemory
Local $sModel
Local $sModelId
Local $sName
Local $sOs
Local $sPlatform
Local $sRadio
Local $iRemoteAccessEnabled
Local $iRemoteDebugEnabled
Local $iHeight
Local $iWidth
Local $iJ
Local $iCount_j
Local $sArn
Local $sDeviceArn
Local $sInstanceProfileArn
Local $sDescription
Local $sInstanceProfileName
Local $iPackageCleanup
Local $iRebootAfterUse
Local $status
Local $sUdid
Local $iK
Local $iCount_k
Local $strVal
Local $sMessage
Local $sV_type
Local $sDeviceAvailability
Local $sDeviceCarrier
Local $sCpuArchitecture
Local $iCpuClock
Local $sCpuFrequency
Local $sDeviceFleetName
Local $sDeviceFleetType
Local $sDeviceFormFactor
Local $iDeviceHeapSize
Local $sDeviceImage
Local $sDeviceManufacturer
Local $iDeviceMemory
Local $sDeviceModel
Local $sDeviceModelId
Local $sDeviceName
Local $sDeviceOs
Local $sDevicePlatform
Local $sDeviceRadio
Local $iDeviceRemoteAccessEnabled
Local $iDeviceRemoteDebugEnabled
Local $iResolutionHeight
Local $iResolutionWidth
Local $sInstanceProfileDescription
Local $instanceProfilePackageCleanup
Local $instanceProfileRebootAfterUse

Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("compatibleDevices")
While $i < $iCount_i
    $oJResp.I = $i
    $iCompatible = $oJResp.IntOf("compatibleDevices[i].compatible")
    $sArn = $oJResp.StringOf("compatibleDevices[i].device.arn")
    $sAvailability = $oJResp.StringOf("compatibleDevices[i].device.availability")
    $sCarrier = $oJResp.StringOf("compatibleDevices[i].device.carrier")
    $sArchitecture = $oJResp.StringOf("compatibleDevices[i].device.cpu.architecture")
    $iClock = $oJResp.IntOf("compatibleDevices[i].device.cpu.clock")
    $sFrequency = $oJResp.StringOf("compatibleDevices[i].device.cpu.frequency")
    $sFleetName = $oJResp.StringOf("compatibleDevices[i].device.fleetName")
    $sFleetType = $oJResp.StringOf("compatibleDevices[i].device.fleetType")
    $sFormFactor = $oJResp.StringOf("compatibleDevices[i].device.formFactor")
    $iHeapSize = $oJResp.IntOf("compatibleDevices[i].device.heapSize")
    $sImage = $oJResp.StringOf("compatibleDevices[i].device.image")
    $sManufacturer = $oJResp.StringOf("compatibleDevices[i].device.manufacturer")
    $iMemory = $oJResp.IntOf("compatibleDevices[i].device.memory")
    $sModel = $oJResp.StringOf("compatibleDevices[i].device.model")
    $sModelId = $oJResp.StringOf("compatibleDevices[i].device.modelId")
    $sName = $oJResp.StringOf("compatibleDevices[i].device.name")
    $sOs = $oJResp.StringOf("compatibleDevices[i].device.os")
    $sPlatform = $oJResp.StringOf("compatibleDevices[i].device.platform")
    $sRadio = $oJResp.StringOf("compatibleDevices[i].device.radio")
    $iRemoteAccessEnabled = $oJResp.IntOf("compatibleDevices[i].device.remoteAccessEnabled")
    $iRemoteDebugEnabled = $oJResp.IntOf("compatibleDevices[i].device.remoteDebugEnabled")
    $iHeight = $oJResp.IntOf("compatibleDevices[i].device.resolution.height")
    $iWidth = $oJResp.IntOf("compatibleDevices[i].device.resolution.width")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("compatibleDevices[i].device.instances")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sArn = $oJResp.StringOf("compatibleDevices[i].device.instances[j].arn")
        $sDeviceArn = $oJResp.StringOf("compatibleDevices[i].device.instances[j].deviceArn")
        $sInstanceProfileArn = $oJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.arn")
        $sDescription = $oJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.description")
        $sInstanceProfileName = $oJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.name")
        $iPackageCleanup = $oJResp.IntOf("compatibleDevices[i].device.instances[j].instanceProfile.packageCleanup")
        $iRebootAfterUse = $oJResp.IntOf("compatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse")
        $status = $oJResp.StringOf("compatibleDevices[i].device.instances[j].status")
        $sUdid = $oJResp.StringOf("compatibleDevices[i].device.instances[j].udid")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("compatibleDevices[i].device.instances[j].labels")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("compatibleDevices[i].device.instances[j].labels[k]")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("compatibleDevices[i].incompatibilityMessages")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sMessage = $oJResp.StringOf("compatibleDevices[i].incompatibilityMessages[j].message")
        $sV_type = $oJResp.StringOf("compatibleDevices[i].incompatibilityMessages[j].type")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("incompatibleDevices")
While $i < $iCount_i
    $oJResp.I = $i
    $iCompatible = $oJResp.IntOf("incompatibleDevices[i].compatible")
    $sDeviceArn = $oJResp.StringOf("incompatibleDevices[i].device.arn")
    $sDeviceAvailability = $oJResp.StringOf("incompatibleDevices[i].device.availability")
    $sDeviceCarrier = $oJResp.StringOf("incompatibleDevices[i].device.carrier")
    $sCpuArchitecture = $oJResp.StringOf("incompatibleDevices[i].device.cpu.architecture")
    $iCpuClock = $oJResp.IntOf("incompatibleDevices[i].device.cpu.clock")
    $sCpuFrequency = $oJResp.StringOf("incompatibleDevices[i].device.cpu.frequency")
    $sDeviceFleetName = $oJResp.StringOf("incompatibleDevices[i].device.fleetName")
    $sDeviceFleetType = $oJResp.StringOf("incompatibleDevices[i].device.fleetType")
    $sDeviceFormFactor = $oJResp.StringOf("incompatibleDevices[i].device.formFactor")
    $iDeviceHeapSize = $oJResp.IntOf("incompatibleDevices[i].device.heapSize")
    $sDeviceImage = $oJResp.StringOf("incompatibleDevices[i].device.image")
    $sDeviceManufacturer = $oJResp.StringOf("incompatibleDevices[i].device.manufacturer")
    $iDeviceMemory = $oJResp.IntOf("incompatibleDevices[i].device.memory")
    $sDeviceModel = $oJResp.StringOf("incompatibleDevices[i].device.model")
    $sDeviceModelId = $oJResp.StringOf("incompatibleDevices[i].device.modelId")
    $sDeviceName = $oJResp.StringOf("incompatibleDevices[i].device.name")
    $sDeviceOs = $oJResp.StringOf("incompatibleDevices[i].device.os")
    $sDevicePlatform = $oJResp.StringOf("incompatibleDevices[i].device.platform")
    $sDeviceRadio = $oJResp.StringOf("incompatibleDevices[i].device.radio")
    $iDeviceRemoteAccessEnabled = $oJResp.IntOf("incompatibleDevices[i].device.remoteAccessEnabled")
    $iDeviceRemoteDebugEnabled = $oJResp.IntOf("incompatibleDevices[i].device.remoteDebugEnabled")
    $iResolutionHeight = $oJResp.IntOf("incompatibleDevices[i].device.resolution.height")
    $iResolutionWidth = $oJResp.IntOf("incompatibleDevices[i].device.resolution.width")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("incompatibleDevices[i].device.instances")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sArn = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].arn")
        $sDeviceArn = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].deviceArn")
        $sInstanceProfileArn = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.arn")
        $sInstanceProfileDescription = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.description")
        $sInstanceProfileName = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.name")
        $instanceProfilePackageCleanup = $oJResp.IntOf("incompatibleDevices[i].device.instances[j].instanceProfile.packageCleanup")
        $instanceProfileRebootAfterUse = $oJResp.IntOf("incompatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse")
        $status = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].status")
        $sUdid = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].udid")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("incompatibleDevices[i].device.instances[j].labels")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $strVal = $oJResp.StringOf("incompatibleDevices[i].device.instances[j].labels[k]")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("incompatibleDevices[i].incompatibilityMessages")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sMessage = $oJResp.StringOf("incompatibleDevices[i].incompatibilityMessages[j].message")
        $sV_type = $oJResp.StringOf("incompatibleDevices[i].incompatibilityMessages[j].type")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend

; 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"
;         }
;       ]
;     }
;   ]
; }