Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) MemberMouse -- getMember API Call

Demonstrates how to use the getMember API call is used to retrieve information about an existing member's account.

See MemberMouse getMember API call for more information.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Variant vReq
    Handle hoReq
    Handle hoHttp
    Variant vResp
    Handle hoResp
    Handle hoJson
    Boolean iSuccess
    Integer i
    Integer iNumBundles
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    // Build the POST request to get a member's data.
    Get Create (RefClass(cComChilkatHttpRequest)) To hoReq
    If (Not(IsComObjectCreated(hoReq))) Begin
        Send CreateComObject of hoReq
    End

    // If your particular API URL is "https://mydomain.com/wp-content/plugins/membermouse/api/request.php",
    // then the Path part of the URL is "/wp-content/plugins/membermouse/api/request.php",
    // and the Domain part of the URL is "mydomain.com".
    // If "https" is used, then the port is 443 (not 80).

    Set ComHttpVerb Of hoReq To "POST"
    // Use the Path part of your API_URL with "?q=/getMember".
    // The command, such as /getMember, /createMember, etc. goes in the Path.
    // The remainder of the POST arguments are query params that go in the body of the request.
    // (Do not put the apikey and apisecret in the Path because the secret will be exposed.
    // You want the confidential information to be in the body of the request.)
    Set ComPath Of hoReq To "/wp-content/plugins/membermouse/api/request.php?q=/getMember"
    Set ComContentType Of hoReq To "application/x-www-form-urlencoded"

    // Add the query params.
    // (Use your particular values in place of "MEMBERMOUSE_...")
    Send ComAddParam To hoReq "apikey" "MEMBERMOUSE_API_KEY"
    Send ComAddParam To hoReq "apisecret" "MEMBERMOUSE_API_SECRET"
    Send ComAddParam To hoReq "email" "some_member@somewhere.com"

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

    // Use the Domain part of your API URL here:
    Get pvComObject of hoReq to vReq
    Get ComSynchronousRequest Of hoHttp "mydomain.com" 443 True vReq To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComBodyStr Of hoResp To sTemp1
    Get ComLoad Of hoJson sTemp1 To iSuccess
    Set ComEmitCompact Of hoJson To False

    // A sample JSON response is shown below..
    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1
    Get ComStatusCode Of hoResp To iTemp1
    Showln "Response Status Code: " iTemp1

    // A response code of 200 is success.
    Get ComStatusCode Of hoResp To iTemp1
    If (iTemp1 = 200) Begin
        // Show a few values from the JSON..
        Get ComStringOf Of hoJson "response_data.first_name" To sTemp1
        Showln "first_name: " sTemp1
        Get ComStringOf Of hoJson "response_data.last_name" To sTemp1
        Showln "last_name: " sTemp1

        // Iterate over the bundles.
        Move 0 To i
        Get ComSizeOfArray Of hoJson "response_data.bundles" To iNumBundles
        While (i < iNumBundles)
            Set ComI Of hoJson To i

            Get ComStringOf Of hoJson "response_data.bundles[i].name" To sTemp1
            Showln "Bundle: " sTemp1
            Move (i + 1) To i
        Loop

    End

    Send Destroy of hoResp

    // ----------------------------------------------------
    // Sample JSON response for /getMember
    // ----------------------------------------------------

    // {
    //   "response_code": "200",
    //   "response_message": "",
    //   "response_data": {
    //     "member_id": 59,
    //     "first_name": "Jim",
    //     "last_name": "Smith",
    //     "is_complimentary": "false",
    //     "registered": "2003-08-08 00:00:00",
    //     "cancellation_date": "",
    //     "last_logged_in": "2017-04-28 16:26:06",
    //     "last_updated": "2017-04-28 16:26:06",
    //     "days_as_member": 5013,
    //     "status": "1",
    //     "status_name": "Active",
    //     "membership_level": "12",
    //     "membership_level_name": "Expert Instructor",
    //     "username": "JSmith",
    //     "email": "some_member@somewhere.com",
    //     "password": null,
    //     "phone": "(618) 555-5555",
    //     "billing_address": "555 Shady Lane",
    //     "billing_city": "Wheaton",
    //     "billing_state": "IL",
    //     "billing_zip": "60187",
    //     "billing_country": "United States",
    //     "shipping_address": "555 Shady Lane",
    //     "shipping_city": "Wheaton",
    //     "shipping_state": "IL",
    //     "shipping_zip": "60187",
    //     "shipping_country": "United States",
    //     "bundles": [
    //       {
    //         "id": "6",
    //         "name": "ABC Bundle",
    //         "is_complimentary": "false",
    //         "days_with_bundle": 2758,
    //         "status": "1",
    //         "status_name": "Active",
    //         "date_added": "2009-10-10 00:00:00",
    //         "last_updated": "2017-03-26 13:00:30"
    //       },
    //       {
    //         "id": "8",
    //         "name": "XZ 2.0 Software License",
    //         "is_complimentary": "false",
    //         "days_with_bundle": 2758,
    //         "status": "1",
    //         "status_name": "Active",
    //         "date_added": "2009-10-10 00:00:00",
    //         "last_updated": "2017-03-26 13:00:30"
    //       }
    //     ],
    //     "custom_fields": [
    //       {
    //         "id": 1,
    //         "name": "Class Location:",
    //         "value": ""
    //       },
    //       {
    //         "id": 2,
    //         "name": "Company",
    //         "value": "Acme Interiors Inc"
    //       },
    //       {
    //         "id": 3,
    //         "name": "Referred by:",
    //         "value": ""
    //       },
    //       {
    //         "id": 4,
    //         "name": "Sound Analysis Equipment",
    //         "value": "AudioTools Sound Analyzer with HAA multi mic Kit"
    //       },
    //       {
    //         "id": 5,
    //         "name": "HAA Member Number",
    //         "value": "22222222"
    //       },
    //       {
    //         "id": 6,
    //         "name": "Alumni Class Dates",
    //         "value": ""
    //       }
    //     ]
    //   }
    // }
    // 


End_Procedure

 

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