Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
MedTunnel

MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter
UniPin
VoiceBase
Vonage
Walmart
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yousign
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Azure Maps Get Search Address

Get information for a given address.

For more information, see https://docs.microsoft.com/en-us/rest/api/maps/search/getsearchaddress

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    String sUrl
    String sStrResp
    Handle hoJsonResponse
    String sSummaryQuery
    String sSummaryQueryType
    Integer iSummaryQueryTime
    Integer iSummaryNumResults
    Integer iSummaryOffset
    Integer iSummaryTotalResults
    Integer iSummaryFuzzyLevel
    Integer i
    Integer iCount_i
    String sV_type
    String sId
    String sScore
    String sAddressStreetNumber
    String sAddressStreetName
    String sAddressMunicipalitySubdivision
    String sAddressMunicipality
    String sAddressCountrySecondarySubdivision
    String sAddressCountryTertiarySubdivision
    String sAddressCountrySubdivision
    String sAddressPostalCode
    String sAddressExtendedPostalCode
    String sAddressCountryCode
    String sAddressCountry
    String sAddressCountryCodeISO3
    String sAddressFreeformAddress
    String sAddressCountrySubdivisionName
    String sPositionLat
    String sPositionLon
    String sViewportTopLeftPointLat
    String sViewportTopLeftPointLon
    String sViewportBtmRightPointLat
    String sViewportBtmRightPointLon
    Integer j
    Integer iCount_j
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

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

    Set ComAccept Of hoHttp To "application/json"

    Move "https://atlas.microsoft.com/search/address/{$format}?subscription-key=[subscription-key]&api-version=1.0&query={$query}" To sUrl

    Get ComSetUrlVar Of hoHttp "format" "json" To iSuccess
    Get ComSetUrlVar Of hoHttp "query" "15127 NE 24th Street, Redmond, WA 98052" To iSuccess

    Get ComQuickGetStr Of hoHttp sUrl To sStrResp
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLastStatus Of hoHttp To iTemp1
    Showln "Response Status Code: " iTemp1

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
    If (Not(IsComObjectCreated(hoJsonResponse))) Begin
        Send CreateComObject of hoJsonResponse
    End
    Get ComLoad Of hoJsonResponse sStrResp To iSuccess
    Set ComEmitCompact Of hoJsonResponse To False
    Get ComEmit Of hoJsonResponse To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iTemp1
    If (iTemp1 <> 200) Begin
        Showln "Failed."
        Procedure_Return
    End

    // Sample output...
    // (See the parsing code below..)
    // 
    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    // {
    //   "summary": {
    //     "query": "15127 NE 24th Street, Redmond, WA 98052",
    //     "queryType": "NON_NEAR",
    //     "queryTime": 58,
    //     "numResults": 1,
    //     "offset": 0,
    //     "totalResults": 1,
    //     "fuzzyLevel": 1
    //   },
    //   "results": [
    //     {
    //       "type": "Point Address",
    //       "id": "US/PAD/p0/19173426",
    //       "score": 14.51,
    //       "address": {
    //         "streetNumber": "15127",
    //         "streetName": "NE 24th St",
    //         "municipalitySubdivision": "Redmond",
    //         "municipality": "Redmond, Adelaide, Ames Lake, Avondale, Earlmount",
    //         "countrySecondarySubdivision": "King",
    //         "countryTertiarySubdivision": "Seattle East",
    //         "countrySubdivision": "WA",
    //         "postalCode": "98052",
    //         "extendedPostalCode": "980525544",
    //         "countryCode": "US",
    //         "country": "United States Of America",
    //         "countryCodeISO3": "USA",
    //         "freeformAddress": "15127 NE 24th St, Redmond, WA 980525544",
    //         "countrySubdivisionName": "Washington"
    //       },
    //       "position": {
    //         "lat": 47.6308,
    //         "lon": -122.1385
    //       },
    //       "viewport": {
    //         "topLeftPoint": {
    //           "lat": 47.6317,
    //           "lon": -122.13983
    //         },
    //         "btmRightPoint": {
    //           "lat": 47.6299,
    //           "lon": -122.13717
    //         }
    //       },
    //       "entryPoints": [
    //         {
    //           "type": "main",
    //           "position": {
    //             "lat": 47.6315,
    //             "lon": -122.13852
    //           }
    //         }
    //       ]
    //     }
    //   ]
    // }
    // 

    Get ComStringOf Of hoJsonResponse "summary.query" To sSummaryQuery
    Get ComStringOf Of hoJsonResponse "summary.queryType" To sSummaryQueryType
    Get ComIntOf Of hoJsonResponse "summary.queryTime" To iSummaryQueryTime
    Get ComIntOf Of hoJsonResponse "summary.numResults" To iSummaryNumResults
    Get ComIntOf Of hoJsonResponse "summary.offset" To iSummaryOffset
    Get ComIntOf Of hoJsonResponse "summary.totalResults" To iSummaryTotalResults
    Get ComIntOf Of hoJsonResponse "summary.fuzzyLevel" To iSummaryFuzzyLevel
    Move 0 To i
    Get ComSizeOfArray Of hoJsonResponse "results" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJsonResponse To i
        Get ComStringOf Of hoJsonResponse "results[i].type" To sV_type
        Get ComStringOf Of hoJsonResponse "results[i].id" To sId
        Get ComStringOf Of hoJsonResponse "results[i].score" To sScore
        Get ComStringOf Of hoJsonResponse "results[i].address.streetNumber" To sAddressStreetNumber
        Get ComStringOf Of hoJsonResponse "results[i].address.streetName" To sAddressStreetName
        Get ComStringOf Of hoJsonResponse "results[i].address.municipalitySubdivision" To sAddressMunicipalitySubdivision
        Get ComStringOf Of hoJsonResponse "results[i].address.municipality" To sAddressMunicipality
        Get ComStringOf Of hoJsonResponse "results[i].address.countrySecondarySubdivision" To sAddressCountrySecondarySubdivision
        Get ComStringOf Of hoJsonResponse "results[i].address.countryTertiarySubdivision" To sAddressCountryTertiarySubdivision
        Get ComStringOf Of hoJsonResponse "results[i].address.countrySubdivision" To sAddressCountrySubdivision
        Get ComStringOf Of hoJsonResponse "results[i].address.postalCode" To sAddressPostalCode
        Get ComStringOf Of hoJsonResponse "results[i].address.extendedPostalCode" To sAddressExtendedPostalCode
        Get ComStringOf Of hoJsonResponse "results[i].address.countryCode" To sAddressCountryCode
        Get ComStringOf Of hoJsonResponse "results[i].address.country" To sAddressCountry
        Get ComStringOf Of hoJsonResponse "results[i].address.countryCodeISO3" To sAddressCountryCodeISO3
        Get ComStringOf Of hoJsonResponse "results[i].address.freeformAddress" To sAddressFreeformAddress
        Get ComStringOf Of hoJsonResponse "results[i].address.countrySubdivisionName" To sAddressCountrySubdivisionName
        Get ComStringOf Of hoJsonResponse "results[i].position.lat" To sPositionLat
        Get ComStringOf Of hoJsonResponse "results[i].position.lon" To sPositionLon
        Get ComStringOf Of hoJsonResponse "results[i].viewport.topLeftPoint.lat" To sViewportTopLeftPointLat
        Get ComStringOf Of hoJsonResponse "results[i].viewport.topLeftPoint.lon" To sViewportTopLeftPointLon
        Get ComStringOf Of hoJsonResponse "results[i].viewport.btmRightPoint.lat" To sViewportBtmRightPointLat
        Get ComStringOf Of hoJsonResponse "results[i].viewport.btmRightPoint.lon" To sViewportBtmRightPointLon
        Move 0 To j
        Get ComSizeOfArray Of hoJsonResponse "results[i].entryPoints" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJsonResponse To j
            Get ComStringOf Of hoJsonResponse "results[i].entryPoints[j].type" To sV_type
            Get ComStringOf Of hoJsonResponse "results[i].entryPoints[j].position.lat" To sPositionLat
            Get ComStringOf Of hoJsonResponse "results[i].entryPoints[j].position.lon" To sPositionLon
            Move j + 1 To j
        Loop

        Move i + 1 To i
    Loop



End_Procedure

 

© 2000-2022 Chilkat Software, Inc. All Rights Reserved.