ListGraphqlApis DataFlex Example
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Variant vAuthAws
Handle hoAuthAws
Variant vSbResponseBody
Handle hoSbResponseBody
Integer iRespStatusCode
Handle hoJResp
String sApiId
String sArn
String sAuthenticationType
Integer iAuthorizerResultTtlInSeconds
String sAuthorizerUri
String sIdentityValidationExpression
String sCloudWatchLogsRoleArn
Integer iExcludeVerboseContent
String sFieldLogLevel
String sName
Integer iAuthTTL
String sClientId
Integer iIatTTL
String sIssuer
String sV_String
String sUrisString
String sAppIdClientRegex
String sAwsRegion
String sDefaultAction
String sUserPoolId
String sWafWebAclArn
Integer iXrayEnabled
Integer j
Integer iCount_j
Integer iLambdaAuthorizerConfigAuthorizerResultTtlInSeconds
String sLambdaAuthorizerConfigAuthorizerUri
String sLambdaAuthorizerConfigIdentityValidationExpression
Integer iOpenIDConnectConfigAuthTTL
String sOpenIDConnectConfigClientId
Integer iOpenIDConnectConfigIatTTL
String sOpenIDConnectConfigIssuer
String sUserPoolConfigAppIdClientRegex
String sUserPoolConfigAwsRegion
String sUserPoolConfigUserPoolId
String sNextToken
Integer i
Integer iCount_i
String sTemp1
Integer iTemp1
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
Get Create (RefClass(cComChilkatAuthAws)) To hoAuthAws
If (Not(IsComObjectCreated(hoAuthAws))) Begin
Send CreateComObject of hoAuthAws
End
Set ComAccessKey Of hoAuthAws To "AWS_ACCESS_KEY"
Set ComSecretKey Of hoAuthAws To "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.)
Set ComRegion Of hoAuthAws To "us-west-2"
Set ComServiceName Of hoAuthAws To "appsync"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
Get pvComObject of hoAuthAws to vAuthAws
Get ComSetAuthAws Of hoRest vAuthAws To iSuccess
// URL: https://appsync.us-west-2.amazonaws.com/
// Use the same region as specified above.
Get ComConnect Of hoRest "appsync.us-west-2.amazonaws.com" 443 True True To iSuccess
If (iSuccess <> True) Begin
Get ComConnectFailReason Of hoRest To iTemp1
Showln "ConnectFailReason: " iTemp1
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComAddHeader Of hoRest "Content-Type" "application/x-amz-json-1.1" To iSuccess
Get ComAddHeader Of hoRest "X-Amz-Target" "ListGraphqlApis" To iSuccess
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComFullRequestNoBodySb Of hoRest "GET" "/v1/apis" vSbResponseBody To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComResponseStatusCode Of hoRest To iRespStatusCode
Showln "response status code = " iRespStatusCode
If (iRespStatusCode <> 200) Begin
Showln "Response Header:"
Get ComResponseHeader Of hoRest To sTemp1
Showln sTemp1
Showln "Response Body:"
Get ComGetAsString Of hoSbResponseBody To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
// 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
Get ComStringOf Of hoJResp "nextToken" To sNextToken
Move 0 To i
Get ComSizeOfArray Of hoJResp "graphqlApis" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "graphqlApis[i].apiId" To sApiId
Get ComStringOf Of hoJResp "graphqlApis[i].arn" To sArn
Get ComStringOf Of hoJResp "graphqlApis[i].authenticationType" To sAuthenticationType
Get ComIntOf Of hoJResp "graphqlApis[i].lambdaAuthorizerConfig.authorizerResultTtlInSeconds" To iAuthorizerResultTtlInSeconds
Get ComStringOf Of hoJResp "graphqlApis[i].lambdaAuthorizerConfig.authorizerUri" To sAuthorizerUri
Get ComStringOf Of hoJResp "graphqlApis[i].lambdaAuthorizerConfig.identityValidationExpression" To sIdentityValidationExpression
Get ComStringOf Of hoJResp "graphqlApis[i].logConfig.cloudWatchLogsRoleArn" To sCloudWatchLogsRoleArn
Get ComIntOf Of hoJResp "graphqlApis[i].logConfig.excludeVerboseContent" To iExcludeVerboseContent
Get ComStringOf Of hoJResp "graphqlApis[i].logConfig.fieldLogLevel" To sFieldLogLevel
Get ComStringOf Of hoJResp "graphqlApis[i].name" To sName
Get ComIntOf Of hoJResp "graphqlApis[i].openIDConnectConfig.authTTL" To iAuthTTL
Get ComStringOf Of hoJResp "graphqlApis[i].openIDConnectConfig.clientId" To sClientId
Get ComIntOf Of hoJResp "graphqlApis[i].openIDConnectConfig.iatTTL" To iIatTTL
Get ComStringOf Of hoJResp "graphqlApis[i].openIDConnectConfig.issuer" To sIssuer
Get ComStringOf Of hoJResp "graphqlApis[i].tags.string" To sV_String
Get ComStringOf Of hoJResp "graphqlApis[i].uris.string" To sUrisString
Get ComStringOf Of hoJResp "graphqlApis[i].userPoolConfig.appIdClientRegex" To sAppIdClientRegex
Get ComStringOf Of hoJResp "graphqlApis[i].userPoolConfig.awsRegion" To sAwsRegion
Get ComStringOf Of hoJResp "graphqlApis[i].userPoolConfig.defaultAction" To sDefaultAction
Get ComStringOf Of hoJResp "graphqlApis[i].userPoolConfig.userPoolId" To sUserPoolId
Get ComStringOf Of hoJResp "graphqlApis[i].wafWebAclArn" To sWafWebAclArn
Get ComIntOf Of hoJResp "graphqlApis[i].xrayEnabled" To iXrayEnabled
Move 0 To j
Get ComSizeOfArray Of hoJResp "graphqlApis[i].additionalAuthenticationProviders" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].authenticationType" To sAuthenticationType
Get ComIntOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.authorizerResultTtlInSeconds" To iLambdaAuthorizerConfigAuthorizerResultTtlInSeconds
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.authorizerUri" To sLambdaAuthorizerConfigAuthorizerUri
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].lambdaAuthorizerConfig.identityValidationExpression" To sLambdaAuthorizerConfigIdentityValidationExpression
Get ComIntOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.authTTL" To iOpenIDConnectConfigAuthTTL
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.clientId" To sOpenIDConnectConfigClientId
Get ComIntOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.iatTTL" To iOpenIDConnectConfigIatTTL
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].openIDConnectConfig.issuer" To sOpenIDConnectConfigIssuer
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.appIdClientRegex" To sUserPoolConfigAppIdClientRegex
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.awsRegion" To sUserPoolConfigAwsRegion
Get ComStringOf Of hoJResp "graphqlApis[i].additionalAuthenticationProviders[j].userPoolConfig.userPoolId" To sUserPoolConfigUserPoolId
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
// A sample JSON response body parsed by the above code:
// {
// "graphqlApis": [
// {
// "additionalAuthenticationProviders": [
// {
// "authenticationType": "string",
// "lambdaAuthorizerConfig": {
// "authorizerResultTtlInSeconds": number,
// "authorizerUri": "string",
// "identityValidationExpression": "string"
// },
// "openIDConnectConfig": {
// "authTTL": number,
// "clientId": "string",
// "iatTTL": number,
// "issuer": "string"
// },
// "userPoolConfig": {
// "appIdClientRegex": "string",
// "awsRegion": "string",
// "userPoolId": "string"
// }
// }
// ],
// "apiId": "string",
// "arn": "string",
// "authenticationType": "string",
// "lambdaAuthorizerConfig": {
// "authorizerResultTtlInSeconds": number,
// "authorizerUri": "string",
// "identityValidationExpression": "string"
// },
// "logConfig": {
// "cloudWatchLogsRoleArn": "string",
// "excludeVerboseContent": boolean,
// "fieldLogLevel": "string"
// },
// "name": "string",
// "openIDConnectConfig": {
// "authTTL": number,
// "clientId": "string",
// "iatTTL": number,
// "issuer": "string"
// },
// "tags": {
// "string": "string"
// },
// "uris": {
// "string": "string"
// },
// "userPoolConfig": {
// "appIdClientRegex": "string",
// "awsRegion": "string",
// "defaultAction": "string",
// "userPoolId": "string"
// },
// "wafWebAclArn": "string",
// "xrayEnabled": boolean
// }
// ],
// "nextToken": "string"
// }
End_Procedure