ScheduleRun Xojo Example
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Dim rest As New Chilkat.Rest
Dim success As Boolean
Dim authAws As New Chilkat.AuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
authAws.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.)
authAws.Region = "us-west-2"
authAws.ServiceName = "devicefarm"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
success = rest.SetAuthAws(authAws)
// URL: https://devicefarm.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect("devicefarm.us-west-2.amazonaws.com",443,True,True)
If (success <> True) Then
System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
System.DebugLog(rest.LastErrorText)
Return
End If
// 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
Dim json As New Chilkat.JsonObject
success = json.UpdateString("appArn","string")
success = json.UpdateString("configuration.auxiliaryApps[0]","string")
success = json.UpdateString("configuration.billingMethod","string")
success = json.UpdateString("configuration.customerArtifactPaths.androidPaths[0]","string")
success = json.UpdateString("configuration.customerArtifactPaths.deviceHostPaths[0]","string")
success = json.UpdateString("configuration.customerArtifactPaths.iosPaths[0]","string")
success = json.UpdateString("configuration.extraDataPackageArn","string")
success = json.UpdateString("configuration.locale","string")
success = json.UpdateInt("configuration.location.latitude",123)
success = json.UpdateInt("configuration.location.longitude",123)
success = json.UpdateString("configuration.networkProfileArn","string")
success = json.UpdateInt("configuration.radios.bluetooth",123)
success = json.UpdateInt("configuration.radios.gps",123)
success = json.UpdateInt("configuration.radios.nfc",123)
success = json.UpdateInt("configuration.radios.wifi",123)
success = json.UpdateString("configuration.vpceConfigurationArns[0]","string")
success = json.UpdateString("devicePoolArn","string")
success = json.UpdateString("deviceSelectionConfiguration.filters[0].attribute","string")
success = json.UpdateString("deviceSelectionConfiguration.filters[0].operator","string")
success = json.UpdateString("deviceSelectionConfiguration.filters[0].values[0]","string")
success = json.UpdateInt("deviceSelectionConfiguration.maxDevices",123)
success = json.UpdateInt("executionConfiguration.accountsCleanup",123)
success = json.UpdateInt("executionConfiguration.appPackagesCleanup",123)
success = json.UpdateInt("executionConfiguration.jobTimeoutMinutes",123)
success = json.UpdateInt("executionConfiguration.skipAppResign",123)
success = json.UpdateInt("executionConfiguration.videoCapture",123)
success = json.UpdateString("name","string")
success = json.UpdateString("projectArn","string")
success = json.UpdateString("test.filter","string")
success = json.UpdateString("test.parameters.string","string")
success = json.UpdateString("test.testPackageArn","string")
success = json.UpdateString("test.testSpecArn","string")
success = json.UpdateString("test.type","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",
// "deviceSelectionConfiguration": {
// "filters": [
// {
// "attribute": "string",
// "operator": "string",
// "values": [
// "string"
// ]
// }
// ],
// "maxDevices": number
// },
// "executionConfiguration": {
// "accountsCleanup": boolean,
// "appPackagesCleanup": boolean,
// "jobTimeoutMinutes": number,
// "skipAppResign": boolean,
// "videoCapture": boolean
// },
// "name": "string",
// "projectArn": "string",
// "test": {
// "filter": "string",
// "parameters": {
// "string": "string"
// },
// "testPackageArn": "string",
// "testSpecArn": "string",
// "type": "string"
// }
// }
success = rest.AddHeader("Content-Type","application/x-amz-json-1.1")
success = rest.AddHeader("X-Amz-Target","DeviceFarm_20150623.ScheduleRun")
Dim sbRequestBody As New Chilkat.StringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody)
If (success <> True) Then
System.DebugLog(rest.LastErrorText)
Return
End If
Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
System.DebugLog("response status code = " + Str(respStatusCode))
If (respStatusCode <> 200) Then
System.DebugLog("Response Header:")
System.DebugLog(rest.ResponseHeader)
System.DebugLog("Response Body:")
System.DebugLog(sbResponseBody.GetAsString())
Return
End If
Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(sbResponseBody)
// 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
Dim strVal As String
Dim attribute As String
Dim operator As String
Dim j As Int32
Dim count_j As Int32
Dim AppUpload As String
AppUpload = jResp.StringOf("run.appUpload")
Dim Arn As String
Arn = jResp.StringOf("run.arn")
Dim BillingMethod As String
BillingMethod = jResp.StringOf("run.billingMethod")
Dim CompletedJobs As Int32
CompletedJobs = jResp.IntOf("run.completedJobs")
Dim Errored As Int32
Errored = jResp.IntOf("run.counters.errored")
Dim Failed As Int32
Failed = jResp.IntOf("run.counters.failed")
Dim Passed As Int32
Passed = jResp.IntOf("run.counters.passed")
Dim Skipped As Int32
Skipped = jResp.IntOf("run.counters.skipped")
Dim Stopped As Int32
Stopped = jResp.IntOf("run.counters.stopped")
Dim Total As Int32
Total = jResp.IntOf("run.counters.total")
Dim Warned As Int32
Warned = jResp.IntOf("run.counters.warned")
Dim Created As Int32
Created = jResp.IntOf("run.created")
Dim Metered As Int32
Metered = jResp.IntOf("run.deviceMinutes.metered")
Dim DeviceMinutesTotal As Int32
DeviceMinutesTotal = jResp.IntOf("run.deviceMinutes.total")
Dim Unmetered As Int32
Unmetered = jResp.IntOf("run.deviceMinutes.unmetered")
Dim DevicePoolArn As String
DevicePoolArn = jResp.StringOf("run.devicePoolArn")
Dim MatchedDevicesCount As Int32
MatchedDevicesCount = jResp.IntOf("run.deviceSelectionResult.matchedDevicesCount")
Dim MaxDevices As Int32
MaxDevices = jResp.IntOf("run.deviceSelectionResult.maxDevices")
Dim EventCount As Int32
EventCount = jResp.IntOf("run.eventCount")
Dim JobTimeoutMinutes As Int32
JobTimeoutMinutes = jResp.IntOf("run.jobTimeoutMinutes")
Dim Locale As String
Locale = jResp.StringOf("run.locale")
Dim Latitude As Int32
Latitude = jResp.IntOf("run.location.latitude")
Dim Longitude As Int32
Longitude = jResp.IntOf("run.location.longitude")
Dim Message As String
Message = jResp.StringOf("run.message")
Dim Name As String
Name = jResp.StringOf("run.name")
Dim NetworkProfileArn As String
NetworkProfileArn = jResp.StringOf("run.networkProfile.arn")
Dim Description As String
Description = jResp.StringOf("run.networkProfile.description")
Dim DownlinkBandwidthBits As Int32
DownlinkBandwidthBits = jResp.IntOf("run.networkProfile.downlinkBandwidthBits")
Dim DownlinkDelayMs As Int32
DownlinkDelayMs = jResp.IntOf("run.networkProfile.downlinkDelayMs")
Dim DownlinkJitterMs As Int32
DownlinkJitterMs = jResp.IntOf("run.networkProfile.downlinkJitterMs")
Dim DownlinkLossPercent As Int32
DownlinkLossPercent = jResp.IntOf("run.networkProfile.downlinkLossPercent")
Dim NetworkProfileName As String
NetworkProfileName = jResp.StringOf("run.networkProfile.name")
Dim v_Type As String
v_Type = jResp.StringOf("run.networkProfile.type")
Dim UplinkBandwidthBits As Int32
UplinkBandwidthBits = jResp.IntOf("run.networkProfile.uplinkBandwidthBits")
Dim UplinkDelayMs As Int32
UplinkDelayMs = jResp.IntOf("run.networkProfile.uplinkDelayMs")
Dim UplinkJitterMs As Int32
UplinkJitterMs = jResp.IntOf("run.networkProfile.uplinkJitterMs")
Dim UplinkLossPercent As Int32
UplinkLossPercent = jResp.IntOf("run.networkProfile.uplinkLossPercent")
Dim ParsingResultUrl As String
ParsingResultUrl = jResp.StringOf("run.parsingResultUrl")
Dim Platform As String
Platform = jResp.StringOf("run.platform")
Dim Bluetooth As Int32
Bluetooth = jResp.IntOf("run.radios.bluetooth")
Dim Gps As Int32
Gps = jResp.IntOf("run.radios.gps")
Dim Nfc As Int32
Nfc = jResp.IntOf("run.radios.nfc")
Dim Wifi As Int32
Wifi = jResp.IntOf("run.radios.wifi")
Dim Result As String
Result = jResp.StringOf("run.result")
Dim ResultCode As String
ResultCode = jResp.StringOf("run.resultCode")
Dim Seed As Int32
Seed = jResp.IntOf("run.seed")
Dim SkipAppResign As Int32
SkipAppResign = jResp.IntOf("run.skipAppResign")
Dim Started As Int32
Started = jResp.IntOf("run.started")
Dim Status As String
Status = jResp.StringOf("run.status")
Dim runStopped As Int32
runStopped = jResp.IntOf("run.stopped")
Dim TestSpecArn As String
TestSpecArn = jResp.StringOf("run.testSpecArn")
Dim TotalJobs As Int32
TotalJobs = jResp.IntOf("run.totalJobs")
Dim runType As String
runType = jResp.StringOf("run.type")
Dim WebUrl As String
WebUrl = jResp.StringOf("run.webUrl")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("run.customerArtifactPaths.androidPaths")
While i < count_i
jResp.I = i
strVal = jResp.StringOf("run.customerArtifactPaths.androidPaths[i]")
i = i + 1
Wend
i = 0
count_i = jResp.SizeOfArray("run.customerArtifactPaths.deviceHostPaths")
While i < count_i
jResp.I = i
strVal = jResp.StringOf("run.customerArtifactPaths.deviceHostPaths[i]")
i = i + 1
Wend
i = 0
count_i = jResp.SizeOfArray("run.customerArtifactPaths.iosPaths")
While i < count_i
jResp.I = i
strVal = jResp.StringOf("run.customerArtifactPaths.iosPaths[i]")
i = i + 1
Wend
i = 0
count_i = jResp.SizeOfArray("run.deviceSelectionResult.filters")
While i < count_i
jResp.I = i
attribute = jResp.StringOf("run.deviceSelectionResult.filters[i].attribute")
operator = jResp.StringOf("run.deviceSelectionResult.filters[i].operator")
j = 0
count_j = jResp.SizeOfArray("run.deviceSelectionResult.filters[i].values")
While j < count_j
jResp.J = j
strVal = jResp.StringOf("run.deviceSelectionResult.filters[i].values[j]")
j = j + 1
Wend
i = i + 1
Wend
// A sample JSON response body parsed by the above code:
// {
// "run": {
// "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"
// }
// }