Sample code for 30+ languages & platforms
DataFlex

Example: Http.S3_FileExists method

Demonstrates the S3_FileExists method.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    String sBucketName
    String sObjectName
    Integer iRetval
    String sTemp1

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Insert your AWS keys here:
    Set ComAwsAccessKey Of hoHttp To "AWS_ACCESS_KEY"
    Set ComAwsSecretKey Of hoHttp To "AWS_SECRET_KEY"

    Move "chilkat.ocean" To sBucketName
    Move "seahorse.jpg" To sObjectName
    Set ComAwsRegion Of hoHttp To "us-west-2"
    Set ComAwsEndpoint Of hoHttp To "s3-us-west-2.amazonaws.com"

    Get ComS3_FileExists Of hoHttp sBucketName sObjectName To iRetval
    If (iRetval < 0) Begin
        Showln "Failed to check for the S3 object existence"
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    If (iRetval = 0) Begin
        Showln "The S3 object does not exist."
        Procedure_Return
    End

    Showln "The S3 object exists."


End_Procedure