PowerBuilder
PowerBuilder
Xero Delete Account
See more Xero Examples
Deletes an account in a Xero company (Accounting API).Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_JsonToken
string ls_Url
oleobject loo_Resp
li_Success = 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_JsonToken = create oleobject
li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject")
li_Success = loo_JsonToken.LoadFile("qa_data/tokens/xero-access-token.json")
if li_Success = 0 then
Write-Debug loo_JsonToken.LastErrorText
destroy loo_Http
destroy loo_JsonToken
return
end if
loo_Http.AuthToken = loo_JsonToken.StringOf("access_token")
// Replace the value here with an actual tenant ID obtained from this example:
// Get Xero Tenant IDs
loo_Http.SetRequestHeader("Xero-tenant-id","83299b9e-5747-4a14-a18a-a6c94f824eb7")
loo_Http.Accept = "application/json"
ls_Url = "https://api.xero.com/api.xro/2.0/Accounts/54ddab14-4a8d-45cf-86be-076c99a0cea0"
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
li_Success = loo_Http.HttpNoBody("DELETE",ls_Url,loo_Resp)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_JsonToken
destroy loo_Resp
return
end if
// A 200 status code indicates success.
Write-Debug "Response Status Code: " + string(loo_Resp.StatusCode)
Write-Debug "Response Body:"
Write-Debug loo_Resp.BodyStr
destroy loo_Http
destroy loo_JsonToken
destroy loo_Resp