Chilkat Online Tools

GetDevicePoolCompatibility SQL Server Example

AWS Device Farm

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @sTmp0 nvarchar(max)
    -- This example requires the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @rest int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    DECLARE @authAws int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.AuthAws', @authAws OUT

    EXEC sp_OASetProperty @authAws, 'AccessKey', 'AWS_ACCESS_KEY'
    EXEC sp_OASetProperty @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.)
    EXEC sp_OASetProperty @authAws, 'Region', 'us-west-2'
    EXEC sp_OASetProperty @authAws, 'ServiceName', 'devicefarm'
    -- SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    EXEC sp_OAMethod @rest, 'SetAuthAws', @success OUT, @authAws

    -- URL: https://devicefarm.us-west-2.amazonaws.com/
    -- Use the same region as specified above.
    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'devicefarm.us-west-2.amazonaws.com', 443, 1, 1
    IF @success <> 1
      BEGIN

        EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
        PRINT 'ConnectFailReason: ' + @iTmp0
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        RETURN
      END

    -- 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

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'appArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.auxiliaryApps[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.billingMethod', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.customerArtifactPaths.androidPaths[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.customerArtifactPaths.deviceHostPaths[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.customerArtifactPaths.iosPaths[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.extraDataPackageArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.locale', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.location.latitude', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.location.longitude', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.networkProfileArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.radios.bluetooth', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.radios.gps', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.radios.nfc', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'configuration.radios.wifi', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'configuration.vpceConfigurationArns[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'devicePoolArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'test.filter', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'test.parameters.string', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'test.testPackageArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'test.testSpecArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'test.type', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, '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"
    -- }

    EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Content-Type', 'application/x-amz-json-1.1'
    EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'X-Amz-Target', 'DeviceFarm_20150623.GetDevicePoolCompatibility'

    DECLARE @sbRequestBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbRequestBody OUT

    EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody
    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @rest, 'FullRequestSb', @success OUT, 'POST', '/', @sbRequestBody, @sbResponseBody
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END
    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @respStatusCode OUT

    PRINT 'response status code = ' + @respStatusCode
    IF @respStatusCode <> 200
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @rest, 'ResponseHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Response Body:'
        EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @authAws
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @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

    DECLARE @compatible int

    DECLARE @Arn nvarchar(max)

    DECLARE @Availability nvarchar(max)

    DECLARE @Carrier nvarchar(max)

    DECLARE @Architecture nvarchar(max)

    DECLARE @Clock int

    DECLARE @Frequency nvarchar(max)

    DECLARE @FleetName nvarchar(max)

    DECLARE @FleetType nvarchar(max)

    DECLARE @FormFactor nvarchar(max)

    DECLARE @HeapSize int

    DECLARE @Image nvarchar(max)

    DECLARE @Manufacturer nvarchar(max)

    DECLARE @Memory int

    DECLARE @Model nvarchar(max)

    DECLARE @ModelId nvarchar(max)

    DECLARE @Name nvarchar(max)

    DECLARE @Os nvarchar(max)

    DECLARE @Platform nvarchar(max)

    DECLARE @Radio nvarchar(max)

    DECLARE @RemoteAccessEnabled int

    DECLARE @RemoteDebugEnabled int

    DECLARE @Height int

    DECLARE @Width int

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @arn nvarchar(max)

    DECLARE @deviceArn nvarchar(max)

    DECLARE @instanceProfileArn nvarchar(max)

    DECLARE @Description nvarchar(max)

    DECLARE @instanceProfileName nvarchar(max)

    DECLARE @PackageCleanup int

    DECLARE @RebootAfterUse int

    DECLARE @status nvarchar(max)

    DECLARE @udid nvarchar(max)

    DECLARE @k int

    DECLARE @count_k int

    DECLARE @strVal nvarchar(max)

    DECLARE @message nvarchar(max)

    DECLARE @v_type nvarchar(max)

    DECLARE @deviceAvailability nvarchar(max)

    DECLARE @deviceCarrier nvarchar(max)

    DECLARE @CpuArchitecture nvarchar(max)

    DECLARE @CpuClock int

    DECLARE @CpuFrequency nvarchar(max)

    DECLARE @deviceFleetName nvarchar(max)

    DECLARE @deviceFleetType nvarchar(max)

    DECLARE @deviceFormFactor nvarchar(max)

    DECLARE @deviceHeapSize int

    DECLARE @deviceImage nvarchar(max)

    DECLARE @deviceManufacturer nvarchar(max)

    DECLARE @deviceMemory int

    DECLARE @deviceModel nvarchar(max)

    DECLARE @deviceModelId nvarchar(max)

    DECLARE @deviceName nvarchar(max)

    DECLARE @deviceOs nvarchar(max)

    DECLARE @devicePlatform nvarchar(max)

    DECLARE @deviceRadio nvarchar(max)

    DECLARE @deviceRemoteAccessEnabled int

    DECLARE @deviceRemoteDebugEnabled int

    DECLARE @ResolutionHeight int

    DECLARE @ResolutionWidth int

    DECLARE @instanceProfileDescription nvarchar(max)

    DECLARE @instanceProfilePackageCleanup int

    DECLARE @instanceProfileRebootAfterUse int

    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'compatibleDevices'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'IntOf', @compatible OUT, 'compatibleDevices[i].compatible'
        EXEC sp_OAMethod @jResp, 'StringOf', @Arn OUT, 'compatibleDevices[i].device.arn'
        EXEC sp_OAMethod @jResp, 'StringOf', @Availability OUT, 'compatibleDevices[i].device.availability'
        EXEC sp_OAMethod @jResp, 'StringOf', @Carrier OUT, 'compatibleDevices[i].device.carrier'
        EXEC sp_OAMethod @jResp, 'StringOf', @Architecture OUT, 'compatibleDevices[i].device.cpu.architecture'
        EXEC sp_OAMethod @jResp, 'IntOf', @Clock OUT, 'compatibleDevices[i].device.cpu.clock'
        EXEC sp_OAMethod @jResp, 'StringOf', @Frequency OUT, 'compatibleDevices[i].device.cpu.frequency'
        EXEC sp_OAMethod @jResp, 'StringOf', @FleetName OUT, 'compatibleDevices[i].device.fleetName'
        EXEC sp_OAMethod @jResp, 'StringOf', @FleetType OUT, 'compatibleDevices[i].device.fleetType'
        EXEC sp_OAMethod @jResp, 'StringOf', @FormFactor OUT, 'compatibleDevices[i].device.formFactor'
        EXEC sp_OAMethod @jResp, 'IntOf', @HeapSize OUT, 'compatibleDevices[i].device.heapSize'
        EXEC sp_OAMethod @jResp, 'StringOf', @Image OUT, 'compatibleDevices[i].device.image'
        EXEC sp_OAMethod @jResp, 'StringOf', @Manufacturer OUT, 'compatibleDevices[i].device.manufacturer'
        EXEC sp_OAMethod @jResp, 'IntOf', @Memory OUT, 'compatibleDevices[i].device.memory'
        EXEC sp_OAMethod @jResp, 'StringOf', @Model OUT, 'compatibleDevices[i].device.model'
        EXEC sp_OAMethod @jResp, 'StringOf', @ModelId OUT, 'compatibleDevices[i].device.modelId'
        EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'compatibleDevices[i].device.name'
        EXEC sp_OAMethod @jResp, 'StringOf', @Os OUT, 'compatibleDevices[i].device.os'
        EXEC sp_OAMethod @jResp, 'StringOf', @Platform OUT, 'compatibleDevices[i].device.platform'
        EXEC sp_OAMethod @jResp, 'StringOf', @Radio OUT, 'compatibleDevices[i].device.radio'
        EXEC sp_OAMethod @jResp, 'IntOf', @RemoteAccessEnabled OUT, 'compatibleDevices[i].device.remoteAccessEnabled'
        EXEC sp_OAMethod @jResp, 'IntOf', @RemoteDebugEnabled OUT, 'compatibleDevices[i].device.remoteDebugEnabled'
        EXEC sp_OAMethod @jResp, 'IntOf', @Height OUT, 'compatibleDevices[i].device.resolution.height'
        EXEC sp_OAMethod @jResp, 'IntOf', @Width OUT, 'compatibleDevices[i].device.resolution.width'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'compatibleDevices[i].device.instances'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @arn OUT, 'compatibleDevices[i].device.instances[j].arn'
            EXEC sp_OAMethod @jResp, 'StringOf', @deviceArn OUT, 'compatibleDevices[i].device.instances[j].deviceArn'
            EXEC sp_OAMethod @jResp, 'StringOf', @instanceProfileArn OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.arn'
            EXEC sp_OAMethod @jResp, 'StringOf', @Description OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.description'
            EXEC sp_OAMethod @jResp, 'StringOf', @instanceProfileName OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.name'
            EXEC sp_OAMethod @jResp, 'IntOf', @PackageCleanup OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.packageCleanup'
            EXEC sp_OAMethod @jResp, 'IntOf', @RebootAfterUse OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse'
            EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'compatibleDevices[i].device.instances[j].status'
            EXEC sp_OAMethod @jResp, 'StringOf', @udid OUT, 'compatibleDevices[i].device.instances[j].udid'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'compatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]'
                SELECT @k = @k + 1
              END
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'compatibleDevices[i].device.instances[j].labels'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'compatibleDevices[i].device.instances[j].labels[k]'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'compatibleDevices[i].incompatibilityMessages'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @message OUT, 'compatibleDevices[i].incompatibilityMessages[j].message'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'compatibleDevices[i].incompatibilityMessages[j].type'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'incompatibleDevices'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'IntOf', @compatible OUT, 'incompatibleDevices[i].compatible'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceArn OUT, 'incompatibleDevices[i].device.arn'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceAvailability OUT, 'incompatibleDevices[i].device.availability'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceCarrier OUT, 'incompatibleDevices[i].device.carrier'
        EXEC sp_OAMethod @jResp, 'StringOf', @CpuArchitecture OUT, 'incompatibleDevices[i].device.cpu.architecture'
        EXEC sp_OAMethod @jResp, 'IntOf', @CpuClock OUT, 'incompatibleDevices[i].device.cpu.clock'
        EXEC sp_OAMethod @jResp, 'StringOf', @CpuFrequency OUT, 'incompatibleDevices[i].device.cpu.frequency'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceFleetName OUT, 'incompatibleDevices[i].device.fleetName'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceFleetType OUT, 'incompatibleDevices[i].device.fleetType'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceFormFactor OUT, 'incompatibleDevices[i].device.formFactor'
        EXEC sp_OAMethod @jResp, 'IntOf', @deviceHeapSize OUT, 'incompatibleDevices[i].device.heapSize'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceImage OUT, 'incompatibleDevices[i].device.image'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceManufacturer OUT, 'incompatibleDevices[i].device.manufacturer'
        EXEC sp_OAMethod @jResp, 'IntOf', @deviceMemory OUT, 'incompatibleDevices[i].device.memory'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceModel OUT, 'incompatibleDevices[i].device.model'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceModelId OUT, 'incompatibleDevices[i].device.modelId'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceName OUT, 'incompatibleDevices[i].device.name'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceOs OUT, 'incompatibleDevices[i].device.os'
        EXEC sp_OAMethod @jResp, 'StringOf', @devicePlatform OUT, 'incompatibleDevices[i].device.platform'
        EXEC sp_OAMethod @jResp, 'StringOf', @deviceRadio OUT, 'incompatibleDevices[i].device.radio'
        EXEC sp_OAMethod @jResp, 'IntOf', @deviceRemoteAccessEnabled OUT, 'incompatibleDevices[i].device.remoteAccessEnabled'
        EXEC sp_OAMethod @jResp, 'IntOf', @deviceRemoteDebugEnabled OUT, 'incompatibleDevices[i].device.remoteDebugEnabled'
        EXEC sp_OAMethod @jResp, 'IntOf', @ResolutionHeight OUT, 'incompatibleDevices[i].device.resolution.height'
        EXEC sp_OAMethod @jResp, 'IntOf', @ResolutionWidth OUT, 'incompatibleDevices[i].device.resolution.width'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'incompatibleDevices[i].device.instances'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @arn OUT, 'incompatibleDevices[i].device.instances[j].arn'
            EXEC sp_OAMethod @jResp, 'StringOf', @deviceArn OUT, 'incompatibleDevices[i].device.instances[j].deviceArn'
            EXEC sp_OAMethod @jResp, 'StringOf', @instanceProfileArn OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.arn'
            EXEC sp_OAMethod @jResp, 'StringOf', @instanceProfileDescription OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.description'
            EXEC sp_OAMethod @jResp, 'StringOf', @instanceProfileName OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.name'
            EXEC sp_OAMethod @jResp, 'IntOf', @instanceProfilePackageCleanup OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.packageCleanup'
            EXEC sp_OAMethod @jResp, 'IntOf', @instanceProfileRebootAfterUse OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.rebootAfterUse'
            EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'incompatibleDevices[i].device.instances[j].status'
            EXEC sp_OAMethod @jResp, 'StringOf', @udid OUT, 'incompatibleDevices[i].device.instances[j].udid'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'incompatibleDevices[i].device.instances[j].instanceProfile.excludeAppPackagesFromCleanup[k]'
                SELECT @k = @k + 1
              END
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'incompatibleDevices[i].device.instances[j].labels'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'incompatibleDevices[i].device.instances[j].labels[k]'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'incompatibleDevices[i].incompatibilityMessages'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @message OUT, 'incompatibleDevices[i].incompatibilityMessages[j].message'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'incompatibleDevices[i].incompatibilityMessages[j].type'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

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

    EXEC @hr = sp_OADestroy @rest
    EXEC @hr = sp_OADestroy @authAws
    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @sbRequestBody
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO