ListRuns autoit Example
; 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("arn","string")
$oJson.UpdateString("nextToken","string")
; The JSON request body created by the above code:
; {
; "arn": "string",
; "nextToken": "string"
; }
$oRest.AddHeader("Content-Type","application/x-amz-json-1.1")
$oRest.AddHeader("X-Amz-Target","DeviceFarm_20150623.ListRuns")
$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 $sAppUpload
Local $sArn
Local $sBillingMethod
Local $iCompletedJobs
Local $iErrored
Local $iFailed
Local $iPassed
Local $iSkipped
Local $iStopped
Local $iTotal
Local $iWarned
Local $iCreated
Local $iMetered
Local $iDeviceMinutesTotal
Local $iUnmetered
Local $sDevicePoolArn
Local $iMatchedDevicesCount
Local $iMaxDevices
Local $iEventCount
Local $iJobTimeoutMinutes
Local $sLocale
Local $iLatitude
Local $iLongitude
Local $sMessage
Local $sName
Local $sArn
Local $sDescription
Local $iDownlinkBandwidthBits
Local $iDownlinkDelayMs
Local $iDownlinkJitterMs
Local $iDownlinkLossPercent
Local $sName
Local $sV_Type
Local $iUplinkBandwidthBits
Local $iUplinkDelayMs
Local $iUplinkJitterMs
Local $iUplinkLossPercent
Local $sParsingResultUrl
Local $sPlatform
Local $iBluetooth
Local $iGps
Local $iNfc
Local $iWifi
Local $sResult
Local $sResultCode
Local $iSeed
Local $iSkipAppResign
Local $iStarted
Local $status
Local $iStopped
Local $sTestSpecArn
Local $iTotalJobs
Local $sV_type
Local $sWebUrl
Local $iJ
Local $iCount_j
Local $strVal
Local $sAttribute
Local $sOperator
Local $iK
Local $iCount_k
Local $sNextToken = $oJResp.StringOf("nextToken")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("runs")
While $i < $iCount_i
$oJResp.I = $i
$sAppUpload = $oJResp.StringOf("runs[i].appUpload")
$sArn = $oJResp.StringOf("runs[i].arn")
$sBillingMethod = $oJResp.StringOf("runs[i].billingMethod")
$iCompletedJobs = $oJResp.IntOf("runs[i].completedJobs")
$iErrored = $oJResp.IntOf("runs[i].counters.errored")
$iFailed = $oJResp.IntOf("runs[i].counters.failed")
$iPassed = $oJResp.IntOf("runs[i].counters.passed")
$iSkipped = $oJResp.IntOf("runs[i].counters.skipped")
$iStopped = $oJResp.IntOf("runs[i].counters.stopped")
$iTotal = $oJResp.IntOf("runs[i].counters.total")
$iWarned = $oJResp.IntOf("runs[i].counters.warned")
$iCreated = $oJResp.IntOf("runs[i].created")
$iMetered = $oJResp.IntOf("runs[i].deviceMinutes.metered")
$iDeviceMinutesTotal = $oJResp.IntOf("runs[i].deviceMinutes.total")
$iUnmetered = $oJResp.IntOf("runs[i].deviceMinutes.unmetered")
$sDevicePoolArn = $oJResp.StringOf("runs[i].devicePoolArn")
$iMatchedDevicesCount = $oJResp.IntOf("runs[i].deviceSelectionResult.matchedDevicesCount")
$iMaxDevices = $oJResp.IntOf("runs[i].deviceSelectionResult.maxDevices")
$iEventCount = $oJResp.IntOf("runs[i].eventCount")
$iJobTimeoutMinutes = $oJResp.IntOf("runs[i].jobTimeoutMinutes")
$sLocale = $oJResp.StringOf("runs[i].locale")
$iLatitude = $oJResp.IntOf("runs[i].location.latitude")
$iLongitude = $oJResp.IntOf("runs[i].location.longitude")
$sMessage = $oJResp.StringOf("runs[i].message")
$sName = $oJResp.StringOf("runs[i].name")
$sArn = $oJResp.StringOf("runs[i].networkProfile.arn")
$sDescription = $oJResp.StringOf("runs[i].networkProfile.description")
$iDownlinkBandwidthBits = $oJResp.IntOf("runs[i].networkProfile.downlinkBandwidthBits")
$iDownlinkDelayMs = $oJResp.IntOf("runs[i].networkProfile.downlinkDelayMs")
$iDownlinkJitterMs = $oJResp.IntOf("runs[i].networkProfile.downlinkJitterMs")
$iDownlinkLossPercent = $oJResp.IntOf("runs[i].networkProfile.downlinkLossPercent")
$sName = $oJResp.StringOf("runs[i].networkProfile.name")
$sV_Type = $oJResp.StringOf("runs[i].networkProfile.type")
$iUplinkBandwidthBits = $oJResp.IntOf("runs[i].networkProfile.uplinkBandwidthBits")
$iUplinkDelayMs = $oJResp.IntOf("runs[i].networkProfile.uplinkDelayMs")
$iUplinkJitterMs = $oJResp.IntOf("runs[i].networkProfile.uplinkJitterMs")
$iUplinkLossPercent = $oJResp.IntOf("runs[i].networkProfile.uplinkLossPercent")
$sParsingResultUrl = $oJResp.StringOf("runs[i].parsingResultUrl")
$sPlatform = $oJResp.StringOf("runs[i].platform")
$iBluetooth = $oJResp.IntOf("runs[i].radios.bluetooth")
$iGps = $oJResp.IntOf("runs[i].radios.gps")
$iNfc = $oJResp.IntOf("runs[i].radios.nfc")
$iWifi = $oJResp.IntOf("runs[i].radios.wifi")
$sResult = $oJResp.StringOf("runs[i].result")
$sResultCode = $oJResp.StringOf("runs[i].resultCode")
$iSeed = $oJResp.IntOf("runs[i].seed")
$iSkipAppResign = $oJResp.IntOf("runs[i].skipAppResign")
$iStarted = $oJResp.IntOf("runs[i].started")
$status = $oJResp.StringOf("runs[i].status")
$iStopped = $oJResp.IntOf("runs[i].stopped")
$sTestSpecArn = $oJResp.StringOf("runs[i].testSpecArn")
$iTotalJobs = $oJResp.IntOf("runs[i].totalJobs")
$sV_type = $oJResp.StringOf("runs[i].type")
$sWebUrl = $oJResp.StringOf("runs[i].webUrl")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("runs[i].customerArtifactPaths.androidPaths")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("runs[i].customerArtifactPaths.androidPaths[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("runs[i].customerArtifactPaths.deviceHostPaths")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("runs[i].customerArtifactPaths.deviceHostPaths[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("runs[i].customerArtifactPaths.iosPaths")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("runs[i].customerArtifactPaths.iosPaths[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("runs[i].deviceSelectionResult.filters")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sAttribute = $oJResp.StringOf("runs[i].deviceSelectionResult.filters[j].attribute")
$sOperator = $oJResp.StringOf("runs[i].deviceSelectionResult.filters[j].operator")
$iK = 0
$iCount_k = $oJResp.SizeOfArray("runs[i].deviceSelectionResult.filters[j].values")
While $iK < $iCount_k
$oJResp.K = $iK
$strVal = $oJResp.StringOf("runs[i].deviceSelectionResult.filters[j].values[k]")
$iK = $iK + 1
Wend
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
; A sample JSON response body parsed by the above code:
; {
; "nextToken": "string",
; "runs": [
; {
; "appUpload": "string",
; "arn": "string",
; "billingMethod": "string",
; "completedJobs": number,
; "counters": {
; "errored": number,
; "failed": number,
; "passed": number,
; "skipped": number,
; "stopped": number,
; "total": number,
; "warned": number
; },
; "created": number,
; "customerArtifactPaths": {
; "androidPaths": [
; "string"
; ],
; "deviceHostPaths": [
; "string"
; ],
; "iosPaths": [
; "string"
; ]
; },
; "deviceMinutes": {
; "metered": number,
; "total": number,
; "unmetered": number
; },
; "devicePoolArn": "string",
; "deviceSelectionResult": {
; "filters": [
; {
; "attribute": "string",
; "operator": "string",
; "values": [
; "string"
; ]
; }
; ],
; "matchedDevicesCount": number,
; "maxDevices": number
; },
; "eventCount": number,
; "jobTimeoutMinutes": number,
; "locale": "string",
; "location": {
; "latitude": number,
; "longitude": number
; },
; "message": "string",
; "name": "string",
; "networkProfile": {
; "arn": "string",
; "description": "string",
; "downlinkBandwidthBits": number,
; "downlinkDelayMs": number,
; "downlinkJitterMs": number,
; "downlinkLossPercent": number,
; "name": "string",
; "type": "string",
; "uplinkBandwidthBits": number,
; "uplinkDelayMs": number,
; "uplinkJitterMs": number,
; "uplinkLossPercent": number
; },
; "parsingResultUrl": "string",
; "platform": "string",
; "radios": {
; "bluetooth": boolean,
; "gps": boolean,
; "nfc": boolean,
; "wifi": boolean
; },
; "result": "string",
; "resultCode": "string",
; "seed": number,
; "skipAppResign": boolean,
; "started": number,
; "status": "string",
; "stopped": number,
; "testSpecArn": "string",
; "totalJobs": number,
; "type": "string",
; "webUrl": "string"
; }
; ]
; }