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

Swift 3,4,5... Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Jira
Lightspeed

MYOB
Magento
MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
Rabobank
SOAP finkok.com
Shippo
Shopify
SimpleTexting
Square
Stripe
SugarCRM
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
Xero
Yousign
_Miscellaneous_
eBay
effectconnect

 

 

 

(Swift 3,4,5...) WhatsApp - Get a User's Account Information

Demonstrates how to retrieve a user account by sending a GET request on the users endpoint.

For more information, see https://developers.facebook.com/docs/whatsapp/api/users/manage

Chilkat Downloads for the Swift Programming Language

MAC OS X (Cocoa) Objective-C/Swift Libs

iOS Objective-C/Swift Libs

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!
    var success: Bool

    // Implements the following CURL command:

    // curl -X GET https://example.com/v1/users/username \
    //   -H "Authorization: Bearer your-auth-token"

    // Adds the "Authorization: Bearer your-auth-token" header.
    http.authToken = "your-auth-token"

    let sbResponseBody = CkoStringBuilder()!
    success = http.quickGetSb("https://example.com/v1/users/username", sbContent: sbResponseBody)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    let jResp = CkoJsonObject()!
    jResp.loadSb(sbResponseBody)
    jResp.emitCompact = false

    print("Response Body:")
    print("\(jResp.emit()!)")

    var respStatusCode: Int = http.lastStatus.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode >= 400 {
        print("Response Header:")
        print("\(http.lastHeader!)")
        print("Failed.")
        return
    }

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "users": [
    //     {
    //       "ROLES": "ROLE_ADMIN | ROLE_USER",
    //       "username": "username"
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...

    var ROLES: String?
    var username: String?

    var i: Int = 0
    var count_i: Int = jResp.size(ofArray: "users").intValue
    while i < count_i {
        jResp.i = i
        ROLES = jResp.string(of: "users[i].ROLES")
        username = jResp.string(of: "users[i].username")
        i = i + 1
    }


}

 

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