Chilkat Online Tools

BatchRead SQL Server Example

Amazon Cloud Directory

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', 'clouddirectory'
    -- SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
    EXEC sp_OAMethod @rest, 'SetAuthAws', @success OUT, @authAws

    -- URL: https://clouddirectory.us-west-2.amazonaws.com/
    -- Use the same region as specified above.
    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'clouddirectory.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, 'Operations[0].GetLinkAttributes.AttributeNames[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].AttributeName', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].Value.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].Value.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].Value.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].Value.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.IdentityAttributeValues[0].Value.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.SourceObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.TargetObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.TypedLinkFacet.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetLinkAttributes.TypedLinkSpecifier.TypedLinkFacet.TypedLinkName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetObjectAttributes.AttributeNames[0]', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetObjectAttributes.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetObjectAttributes.SchemaFacet.FacetName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetObjectAttributes.SchemaFacet.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].GetObjectInformation.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListAttachedIndices.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListAttachedIndices.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListAttachedIndices.TargetReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].AttributeName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.EndValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterAttributeRanges[0].Range.StartValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterTypedLink.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.FilterTypedLink.TypedLinkName', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIncomingTypedLinks.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIncomingTypedLinks.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.IndexReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].AttributeKey.FacetName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].AttributeKey.Name', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].AttributeKey.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.EndValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListIndex.RangesOnIndexedValues[0].Range.StartValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectAttributes.FacetFilter.FacetName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectAttributes.FacetFilter.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListObjectAttributes.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectAttributes.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectAttributes.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListObjectChildren.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectChildren.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectChildren.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListObjectParentPaths.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectParentPaths.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectParentPaths.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListObjectParents.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectParents.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectParents.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListObjectPolicies.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectPolicies.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListObjectPolicies.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].AttributeName', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.EndValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartMode', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartValue.BinaryValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartValue.BooleanValue', 123
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartValue.DatetimeValue', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartValue.NumberValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterAttributeRanges[0].Range.StartValue.StringValue', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterTypedLink.SchemaArn', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.FilterTypedLink.TypedLinkName', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListOutgoingTypedLinks.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListOutgoingTypedLinks.ObjectReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].ListPolicyAttachments.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListPolicyAttachments.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].ListPolicyAttachments.PolicyReference.Selector', 'string'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'Operations[0].LookupPolicy.MaxResults', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].LookupPolicy.NextToken', 'string'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'Operations[0].LookupPolicy.ObjectReference.Selector', 'string'

    -- The JSON request body created by the above code:

    -- {
    --   "Operations": [
    --     {
    --       "GetLinkAttributes": {
    --         "AttributeNames": [
    --           "string"
    --         ],
    --         "TypedLinkSpecifier": {
    --           "IdentityAttributeValues": [
    --             {
    --               "AttributeName": "string",
    --               "Value": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           ],
    --           "SourceObjectReference": {
    --             "Selector": "string"
    --           },
    --           "TargetObjectReference": {
    --             "Selector": "string"
    --           },
    --           "TypedLinkFacet": {
    --             "SchemaArn": "string",
    --             "TypedLinkName": "string"
    --           }
    --         }
    --       },
    --       "GetObjectAttributes": {
    --         "AttributeNames": [
    --           "string"
    --         ],
    --         "ObjectReference": {
    --           "Selector": "string"
    --         },
    --         "SchemaFacet": {
    --           "FacetName": "string",
    --           "SchemaArn": "string"
    --         }
    --       },
    --       "GetObjectInformation": {
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListAttachedIndices": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "TargetReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListIncomingTypedLinks": {
    --         "FilterAttributeRanges": [
    --           {
    --             "AttributeName": "string",
    --             "Range": {
    --               "EndMode": "string",
    --               "EndValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               },
    --               "StartMode": "string",
    --               "StartValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           }
    --         ],
    --         "FilterTypedLink": {
    --           "SchemaArn": "string",
    --           "TypedLinkName": "string"
    --         },
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListIndex": {
    --         "IndexReference": {
    --           "Selector": "string"
    --         },
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "RangesOnIndexedValues": [
    --           {
    --             "AttributeKey": {
    --               "FacetName": "string",
    --               "Name": "string",
    --               "SchemaArn": "string"
    --             },
    --             "Range": {
    --               "EndMode": "string",
    --               "EndValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               },
    --               "StartMode": "string",
    --               "StartValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           }
    --         ]
    --       },
    --       "ListObjectAttributes": {
    --         "FacetFilter": {
    --           "FacetName": "string",
    --           "SchemaArn": "string"
    --         },
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListObjectChildren": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListObjectParentPaths": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListObjectParents": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListObjectPolicies": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListOutgoingTypedLinks": {
    --         "FilterAttributeRanges": [
    --           {
    --             "AttributeName": "string",
    --             "Range": {
    --               "EndMode": "string",
    --               "EndValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               },
    --               "StartMode": "string",
    --               "StartValue": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           }
    --         ],
    --         "FilterTypedLink": {
    --           "SchemaArn": "string",
    --           "TypedLinkName": "string"
    --         },
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "ListPolicyAttachments": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "PolicyReference": {
    --           "Selector": "string"
    --         }
    --       },
    --       "LookupPolicy": {
    --         "MaxResults": number,
    --         "NextToken": "string",
    --         "ObjectReference": {
    --           "Selector": "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', 'BatchRead'

    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', '/amazonclouddirectory/2017-01-11/batchread', @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 @Message nvarchar(max)

    DECLARE @v_Type nvarchar(max)

    DECLARE @ObjectIdentifier nvarchar(max)

    DECLARE @NextToken nvarchar(max)

    DECLARE @ListIncomingTypedLinksNextToken nvarchar(max)

    DECLARE @ListIndexNextToken nvarchar(max)

    DECLARE @ListObjectAttributesNextToken nvarchar(max)

    DECLARE @v_String nvarchar(max)

    DECLARE @ListObjectChildrenNextToken nvarchar(max)

    DECLARE @ListObjectParentPathsNextToken nvarchar(max)

    DECLARE @ListObjectParentsNextToken nvarchar(max)

    DECLARE @ListObjectPoliciesNextToken nvarchar(max)

    DECLARE @ListOutgoingTypedLinksNextToken nvarchar(max)

    DECLARE @ListPolicyAttachmentsNextToken nvarchar(max)

    DECLARE @LookupPolicyNextToken nvarchar(max)

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @FacetName nvarchar(max)

    DECLARE @Name nvarchar(max)

    DECLARE @SchemaArn nvarchar(max)

    DECLARE @BinaryValue int

    DECLARE @BooleanValue int

    DECLARE @DatetimeValue int

    DECLARE @NumberValue nvarchar(max)

    DECLARE @StringValue nvarchar(max)

    DECLARE @KeyFacetName nvarchar(max)

    DECLARE @KeyName nvarchar(max)

    DECLARE @KeySchemaArn nvarchar(max)

    DECLARE @ValueBinaryValue int

    DECLARE @ValueBooleanValue int

    DECLARE @ValueDatetimeValue int

    DECLARE @ValueNumberValue nvarchar(max)

    DECLARE @ValueStringValue nvarchar(max)

    DECLARE @k int

    DECLARE @count_k int

    DECLARE @Selector nvarchar(max)

    DECLARE @TargetObjectReferenceSelector nvarchar(max)

    DECLARE @TypedLinkFacetSchemaArn nvarchar(max)

    DECLARE @TypedLinkName nvarchar(max)

    DECLARE @AttributeName nvarchar(max)

    DECLARE @Path nvarchar(max)

    DECLARE @strVal nvarchar(max)

    DECLARE @LinkName nvarchar(max)

    DECLARE @SourceObjectReferenceSelector nvarchar(max)

    DECLARE @TypedLinkFacetTypedLinkName nvarchar(max)

    DECLARE @PolicyId nvarchar(max)

    DECLARE @PolicyType nvarchar(max)

    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'Responses'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @Message OUT, 'Responses[i].ExceptionResponse.Message'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'Responses[i].ExceptionResponse.Type'
        EXEC sp_OAMethod @jResp, 'StringOf', @ObjectIdentifier OUT, 'Responses[i].SuccessfulResponse.GetObjectInformation.ObjectIdentifier'
        EXEC sp_OAMethod @jResp, 'StringOf', @NextToken OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListIncomingTypedLinksNextToken OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListIndexNextToken OUT, 'Responses[i].SuccessfulResponse.ListIndex.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListObjectAttributesNextToken OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_String OUT, 'Responses[i].SuccessfulResponse.ListObjectChildren.Children.string'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListObjectChildrenNextToken OUT, 'Responses[i].SuccessfulResponse.ListObjectChildren.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListObjectParentPathsNextToken OUT, 'Responses[i].SuccessfulResponse.ListObjectParentPaths.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListObjectParentsNextToken OUT, 'Responses[i].SuccessfulResponse.ListObjectParents.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListObjectPoliciesNextToken OUT, 'Responses[i].SuccessfulResponse.ListObjectPolicies.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListOutgoingTypedLinksNextToken OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @ListPolicyAttachmentsNextToken OUT, 'Responses[i].SuccessfulResponse.ListPolicyAttachments.NextToken'
        EXEC sp_OAMethod @jResp, 'StringOf', @LookupPolicyNextToken OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.NextToken'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @FacetName OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Key.FacetName'
            EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Key.Name'
            EXEC sp_OAMethod @jResp, 'StringOf', @SchemaArn OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Key.SchemaArn'
            EXEC sp_OAMethod @jResp, 'IntOf', @BinaryValue OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Value.BinaryValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @BooleanValue OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Value.BooleanValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @DatetimeValue OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Value.DatetimeValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @NumberValue OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Value.NumberValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @StringValue OUT, 'Responses[i].SuccessfulResponse.GetLinkAttributes.Attributes[j].Value.StringValue'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @KeyFacetName OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Key.FacetName'
            EXEC sp_OAMethod @jResp, 'StringOf', @KeyName OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Key.Name'
            EXEC sp_OAMethod @jResp, 'StringOf', @KeySchemaArn OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Key.SchemaArn'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Value.BinaryValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Value.BooleanValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Value.DatetimeValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Value.NumberValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.GetObjectAttributes.Attributes[j].Value.StringValue'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.GetObjectInformation.SchemaFacets'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @FacetName OUT, 'Responses[i].SuccessfulResponse.GetObjectInformation.SchemaFacets[j].FacetName'
            EXEC sp_OAMethod @jResp, 'StringOf', @SchemaArn OUT, 'Responses[i].SuccessfulResponse.GetObjectInformation.SchemaFacets[j].SchemaArn'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @ObjectIdentifier OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].ObjectIdentifier'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @KeyFacetName OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Key.FacetName'
                EXEC sp_OAMethod @jResp, 'StringOf', @KeyName OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Key.Name'
                EXEC sp_OAMethod @jResp, 'StringOf', @KeySchemaArn OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Key.SchemaArn'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Value.BinaryValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Value.BooleanValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Value.DatetimeValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Value.NumberValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.ListAttachedIndices.IndexAttachments[j].IndexedAttributes[k].Value.StringValue'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @Selector OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].SourceObjectReference.Selector'
            EXEC sp_OAMethod @jResp, 'StringOf', @TargetObjectReferenceSelector OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].TargetObjectReference.Selector'
            EXEC sp_OAMethod @jResp, 'StringOf', @TypedLinkFacetSchemaArn OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].TypedLinkFacet.SchemaArn'
            EXEC sp_OAMethod @jResp, 'StringOf', @TypedLinkName OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].TypedLinkFacet.TypedLinkName'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @AttributeName OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].AttributeName'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].Value.BinaryValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].Value.BooleanValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].Value.DatetimeValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].Value.NumberValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.ListIncomingTypedLinks.LinkSpecifiers[j].IdentityAttributeValues[k].Value.StringValue'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @ObjectIdentifier OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].ObjectIdentifier'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @KeyFacetName OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Key.FacetName'
                EXEC sp_OAMethod @jResp, 'StringOf', @KeyName OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Key.Name'
                EXEC sp_OAMethod @jResp, 'StringOf', @KeySchemaArn OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Key.SchemaArn'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Value.BinaryValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Value.BooleanValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Value.DatetimeValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Value.NumberValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.ListIndex.IndexAttachments[j].IndexedAttributes[k].Value.StringValue'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @KeyFacetName OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Key.FacetName'
            EXEC sp_OAMethod @jResp, 'StringOf', @KeyName OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Key.Name'
            EXEC sp_OAMethod @jResp, 'StringOf', @KeySchemaArn OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Key.SchemaArn'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Value.BinaryValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Value.BooleanValue'
            EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Value.DatetimeValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Value.NumberValue'
            EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.ListObjectAttributes.Attributes[j].Value.StringValue'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListObjectParentPaths.PathToObjectIdentifiersList'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @Path OUT, 'Responses[i].SuccessfulResponse.ListObjectParentPaths.PathToObjectIdentifiersList[j].Path'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.ListObjectParentPaths.PathToObjectIdentifiersList[j].ObjectIdentifiers'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'Responses[i].SuccessfulResponse.ListObjectParentPaths.PathToObjectIdentifiersList[j].ObjectIdentifiers[k]'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListObjectParents.ParentLinks'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @LinkName OUT, 'Responses[i].SuccessfulResponse.ListObjectParents.ParentLinks[j].LinkName'
            EXEC sp_OAMethod @jResp, 'StringOf', @ObjectIdentifier OUT, 'Responses[i].SuccessfulResponse.ListObjectParents.ParentLinks[j].ObjectIdentifier'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListObjectPolicies.AttachedPolicyIds'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'Responses[i].SuccessfulResponse.ListObjectPolicies.AttachedPolicyIds[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @SourceObjectReferenceSelector OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].SourceObjectReference.Selector'
            EXEC sp_OAMethod @jResp, 'StringOf', @TargetObjectReferenceSelector OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].TargetObjectReference.Selector'
            EXEC sp_OAMethod @jResp, 'StringOf', @TypedLinkFacetSchemaArn OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].TypedLinkFacet.SchemaArn'
            EXEC sp_OAMethod @jResp, 'StringOf', @TypedLinkFacetTypedLinkName OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].TypedLinkFacet.TypedLinkName'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @AttributeName OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].AttributeName'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBinaryValue OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].Value.BinaryValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueBooleanValue OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].Value.BooleanValue'
                EXEC sp_OAMethod @jResp, 'IntOf', @ValueDatetimeValue OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].Value.DatetimeValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueNumberValue OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].Value.NumberValue'
                EXEC sp_OAMethod @jResp, 'StringOf', @ValueStringValue OUT, 'Responses[i].SuccessfulResponse.ListOutgoingTypedLinks.TypedLinkSpecifiers[j].IdentityAttributeValues[k].Value.StringValue'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.ListPolicyAttachments.ObjectIdentifiers'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'Responses[i].SuccessfulResponse.ListPolicyAttachments.ObjectIdentifiers[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @Path OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList[j].Path'
            SELECT @k = 0
            EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_k OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList[j].Policies'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @jResp, 'K', @k
                EXEC sp_OAMethod @jResp, 'StringOf', @ObjectIdentifier OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList[j].Policies[k].ObjectIdentifier'
                EXEC sp_OAMethod @jResp, 'StringOf', @PolicyId OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList[j].Policies[k].PolicyId'
                EXEC sp_OAMethod @jResp, 'StringOf', @PolicyType OUT, 'Responses[i].SuccessfulResponse.LookupPolicy.PolicyToPathList[j].Policies[k].PolicyType'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    -- A sample JSON response body parsed by the above code:

    -- {
    --   "Responses": [
    --     {
    --       "ExceptionResponse": {
    --         "Message": "string",
    --         "Type": "string"
    --       },
    --       "SuccessfulResponse": {
    --         "GetLinkAttributes": {
    --           "Attributes": [
    --             {
    --               "Key": {
    --                 "FacetName": "string",
    --                 "Name": "string",
    --                 "SchemaArn": "string"
    --               },
    --               "Value": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           ]
    --         },
    --         "GetObjectAttributes": {
    --           "Attributes": [
    --             {
    --               "Key": {
    --                 "FacetName": "string",
    --                 "Name": "string",
    --                 "SchemaArn": "string"
    --               },
    --               "Value": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           ]
    --         },
    --         "GetObjectInformation": {
    --           "ObjectIdentifier": "string",
    --           "SchemaFacets": [
    --             {
    --               "FacetName": "string",
    --               "SchemaArn": "string"
    --             }
    --           ]
    --         },
    --         "ListAttachedIndices": {
    --           "IndexAttachments": [
    --             {
    --               "IndexedAttributes": [
    --                 {
    --                   "Key": {
    --                     "FacetName": "string",
    --                     "Name": "string",
    --                     "SchemaArn": "string"
    --                   },
    --                   "Value": {
    --                     "BinaryValue": blob,
    --                     "BooleanValue": boolean,
    --                     "DatetimeValue": number,
    --                     "NumberValue": "string",
    --                     "StringValue": "string"
    --                   }
    --                 }
    --               ],
    --               "ObjectIdentifier": "string"
    --             }
    --           ],
    --           "NextToken": "string"
    --         },
    --         "ListIncomingTypedLinks": {
    --           "LinkSpecifiers": [
    --             {
    --               "IdentityAttributeValues": [
    --                 {
    --                   "AttributeName": "string",
    --                   "Value": {
    --                     "BinaryValue": blob,
    --                     "BooleanValue": boolean,
    --                     "DatetimeValue": number,
    --                     "NumberValue": "string",
    --                     "StringValue": "string"
    --                   }
    --                 }
    --               ],
    --               "SourceObjectReference": {
    --                 "Selector": "string"
    --               },
    --               "TargetObjectReference": {
    --                 "Selector": "string"
    --               },
    --               "TypedLinkFacet": {
    --                 "SchemaArn": "string",
    --                 "TypedLinkName": "string"
    --               }
    --             }
    --           ],
    --           "NextToken": "string"
    --         },
    --         "ListIndex": {
    --           "IndexAttachments": [
    --             {
    --               "IndexedAttributes": [
    --                 {
    --                   "Key": {
    --                     "FacetName": "string",
    --                     "Name": "string",
    --                     "SchemaArn": "string"
    --                   },
    --                   "Value": {
    --                     "BinaryValue": blob,
    --                     "BooleanValue": boolean,
    --                     "DatetimeValue": number,
    --                     "NumberValue": "string",
    --                     "StringValue": "string"
    --                   }
    --                 }
    --               ],
    --               "ObjectIdentifier": "string"
    --             }
    --           ],
    --           "NextToken": "string"
    --         },
    --         "ListObjectAttributes": {
    --           "Attributes": [
    --             {
    --               "Key": {
    --                 "FacetName": "string",
    --                 "Name": "string",
    --                 "SchemaArn": "string"
    --               },
    --               "Value": {
    --                 "BinaryValue": blob,
    --                 "BooleanValue": boolean,
    --                 "DatetimeValue": number,
    --                 "NumberValue": "string",
    --                 "StringValue": "string"
    --               }
    --             }
    --           ],
    --           "NextToken": "string"
    --         },
    --         "ListObjectChildren": {
    --           "Children": {
    --             "string": "string"
    --           },
    --           "NextToken": "string"
    --         },
    --         "ListObjectParentPaths": {
    --           "NextToken": "string",
    --           "PathToObjectIdentifiersList": [
    --             {
    --               "ObjectIdentifiers": [
    --                 "string"
    --               ],
    --               "Path": "string"
    --             }
    --           ]
    --         },
    --         "ListObjectParents": {
    --           "NextToken": "string",
    --           "ParentLinks": [
    --             {
    --               "LinkName": "string",
    --               "ObjectIdentifier": "string"
    --             }
    --           ]
    --         },
    --         "ListObjectPolicies": {
    --           "AttachedPolicyIds": [
    --             "string"
    --           ],
    --           "NextToken": "string"
    --         },
    --         "ListOutgoingTypedLinks": {
    --           "NextToken": "string",
    --           "TypedLinkSpecifiers": [
    --             {
    --               "IdentityAttributeValues": [
    --                 {
    --                   "AttributeName": "string",
    --                   "Value": {
    --                     "BinaryValue": blob,
    --                     "BooleanValue": boolean,
    --                     "DatetimeValue": number,
    --                     "NumberValue": "string",
    --                     "StringValue": "string"
    --                   }
    --                 }
    --               ],
    --               "SourceObjectReference": {
    --                 "Selector": "string"
    --               },
    --               "TargetObjectReference": {
    --                 "Selector": "string"
    --               },
    --               "TypedLinkFacet": {
    --                 "SchemaArn": "string",
    --                 "TypedLinkName": "string"
    --               }
    --             }
    --           ]
    --         },
    --         "ListPolicyAttachments": {
    --           "NextToken": "string",
    --           "ObjectIdentifiers": [
    --             "string"
    --           ]
    --         },
    --         "LookupPolicy": {
    --           "NextToken": "string",
    --           "PolicyToPathList": [
    --             {
    --               "Path": "string",
    --               "Policies": [
    --                 {
    --                   "ObjectIdentifier": "string",
    --                   "PolicyId": "string",
    --                   "PolicyType": "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