Chilkat Examples

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

Swift 2 Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(Swift 2) GetHarvest - Delete Contact

Delete a contact. Returns a 200 OK response code if the call succeeded.

For more information, see https://help.getharvest.com/api-v2/clients-api/clients/contacts/

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 "https://api.harvestapp.com/v2/contacts/CONTACT_ID" \
    //   -H "Authorization: Bearer ACCESS_TOKEN" \
    //   -H "Harvest-Account-Id: ACCOUNT_ID" \
    //   -H "User-Agent: MyApp (yourname@example.com)" \
    //   -X DELETE

    http.SetRequestHeader("User-Agent", value: "MyApp (yourname@example.com)")
    http.SetRequestHeader("Authorization", value: "Bearer ACCESS_TOKEN")
    http.SetRequestHeader("Harvest-Account-Id", value: "ACCOUNT_ID")

    var resp: CkoHttpResponse? = http.QuickRequest("DELETE", url: "https://api.harvestapp.com/v2/contacts/CONTACT_ID")
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    var respStatusCode: Int = resp!.StatusCode.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode != 200 {
        print("Response Header:")
        print("\(resp!.Header)")
        print("Response Body:")
        print("\(resp!.BodyStr)")
        print("Failed.")
        resp = nil
        return
    }

    resp = nil
    print("Success.")

}

 

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