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

Java 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

 

 

 

(Java) Xero Delete File (FILES API)

Delete a file via the Xero FILES API.

Note: This example requires Chilkat v9.5.0.64 or greater.

Chilkat Java Downloads

Java Libs for Windows, Linux, Alpine Linux,
MAC OS X, Solaris, FreeBSD, OpenBSD,
Raspberry Pi and other single board computers

Java Libs for Android

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    // Note: Requires Chilkat v9.5.0.64 or greater.

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

    CkRest rest = new CkRest();
    boolean success;

    // Before sending REST API calls, the REST object needs to be
    // initialized for OAuth1.
    // See Xero 2-Legged OAuth1 Setup for sample code.

    // Assuming the REST object's OAuth1 authenticator is setup, and the initial
    // connection was made, we may now send REST HTTP requests..

    // ------------------------------------------------------------------------------
    String fileID = "f042e9a3-a31d-4595-b8b3-6030ea6084bb";

    CkStringBuilder sbPath = new CkStringBuilder();
    sbPath.Append("/files.xro/1.0/Files/{FileId}");
    int numReplaced = sbPath.Replace("{FileId}",fileID);

    String jsonResponse = rest.fullRequestNoBody("DELETE",sbPath.getAsString());
    if (success != true) {
        System.out.println(rest.lastErrorText());
        return;
        }

    // A 201 response is expected for actual success.
    if (rest.get_ResponseStatusCode() != 201) {
        System.out.println(jsonResponse);
        System.out.println("-- Failed.");
        return;
        }

    System.out.println("Xero Delete File was Successful.");
  }
}

 

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