rc_Client

Executes and handles response for API calls to Xero’s accounting and practice manager APIs.

Properties

Method
Get | Let {WebMethod}

Set the HTTP method to be used for the request: GET, POST, PUT, PATCH, DELETE.


Format
Get | Let {WebFormat}

Set the API request and response format: XML, Json.


ApiResource
Get | Let {rcApiResource}

Application API specific resource for request.

 Dim radius_Client As New rc_Client

 radius_Client.ApiResource = xroResBankTransactions
 -> Url: https://api.xero.com/api.xro/2.0/BankTransactions

 radius_Client.ApiResource = xpmResClient
 -> Url: https://api.xero.com/practicemanager/3.1/client.api

 radius_Client.ApiResource = wfmResJob
 -> Url: https://api.xero.com/workflowmax/3.0/job.api

ApiMethod
Get | Let {rcApiMethod}

Xero Practice Manager or WorkflowMax method for request url.

 Dim radius_Client As New rc_Client

 radius_Client.ApiResource = xpmResJob
 radius_Client.ApiMethod = xpmMthCurrent
 -> Url: https://api.xero.com/practicemanager/3.1/job.api/Current

 radius_Client.ApiResource = wfmResClient
 radius_Client.ApiMethod = wfmMthAddRelationship
 -> Url: https://api.xero.com/workflowmax/3.0/client.api/addrelationship

XeroIdentifier
Get | Let {String}

Optional identifier used in various Xero/Practice manager APIs.

 Dim radius_Client As New rc_Client

 radius_Client.ApiResource = rcApiResource.xroResJournals
 radius_Client.XeroIdentifier = "243"
 ' -> Url: https://api.xero.com/api.xro/2.0/Journals/243

 radius_Client.ApiResource = rcApiResource.xpmResClient
 radius_Client.ApiMethod = rcApiMethod.xpmMthGet
 radius_Client.XeroIdentifier = "f8235e1a-d383-48b7-9139-ba97ab8ca889"
 ' ->  Url: https://api.xero.com/practicemanager/3.1/client.api/get/f8235e1a-d383-48b7-9139-ba97ab8ca889

Body
Get | Set {Dictionary}

Set pre-made Body dictionary. To add Json body parameters, use AddBodyParam, or XML body parameters AddBodyNode.


QuerystringParams
Get | Set {Collection}

Collection of querystring parameters to include with request, stored as Key-Value pairs. To add querystring parameters, use AddQuerystringParam.


Data
Get {Collection|DOMDocument}

Parsed response data. Collection for Json, DOMDocument for XML.


UseSubXpmCon
Get | Let {Boolean}

Whether to use the User's active subscription's master XPM connection for this instance of the API Client.

If set to True, the connection is activated in the Execute method and the original connection restored when the object is terminated. This allows the connection details to be cached where required.


Methods

AddBodyParam (Key, Value)
    Key - {String}
    Value - {String}

Add Key-Value to Body.

 Dim radius_Client As New rc_Client
 radius_Client.Format = WebFormat.Json

 radius_Client.AddBodyParameter "a", 123
 ' --> Body ' -> "{"a":123}"

AddBodyNode (Name, Value, ParentNode, AttributeName, AttributeValue)
    Name - {String} | Node name.
    Value - {Variant} | Optional. Node value.
    ParentNode - {String} | Optional. Parent node holde all nodes added using this method. Only needs to be specified once. If specified multiple times, only the last value will be used.
    AttributeName - {String} | Optional. Include to add an attribute name to the node.
    AttributeValue - {String} | Optional. Include to add an attribute value to the node.

Add XML node to Body. Can only be used to construct simple XML structures.

 Dim radius_Client as New rc_Client
 radius_Client.Format = WebFormat.XML

 radius_Client.AddBodyParameter "a", 123, "alphabet"
 radius_Client.AddBodyParameter "b", 456, "alphabet"

 --> Body ' -> "<alphabet><a>123</a><b>456</b></alphabet>"

AddQuerystringParam (Key, Value)
    Key - {String}
    Value - {String}

Add querystring parameter to be used in request.

 Dim radius_Client As New rc_Client
 radius_Client.AddQuerystringParam "page", "1"

 ' -> Url: ..../?page=1

Setup (Method, Format, ApiResource, ApiMethod, XeroIdentifier)
    Method - {WebMethod} | Set the HTTP method to be used for the request.
    Format - {WebFormat} | Set the web format to be used to convert response to data.
    ApiResource - {rcApiResource} | API resource to use for the request.
    ApiMethod - {rcApiMethod} | Optional. API method to use for the request (Practice Manager and WorkflowMax only).
    XeroIdentifier - {String} | Optional. Identifier used in various Xero API resources.

Provides for easy setup of required parameters for all API calls.


Execute ()

Execute API request. Run Setup first.


DEPRECATED Properties (v1.3.0)

Resource
Get | Let {xeroResource|xpmResource}

API endpoint for request. Differs depending on which API is being used.

Dim radius_Client As New rc_Client
 radius_Client.Resource = xeroResource.BankTransactions
 ' -> Url: https://api.xero.com/api.xro/2.0/BankTransactions

 radius_Client.Resource = xpmResource.Client
 ' -> Url: https://api.xero.com/practicemanager/3.1/client.api

EndPoint
Get | Let {xpmEndPoint}

Xero Practice Manager method for request URL.

Dim radius_Client As New rc_Client
radius_Client.Resource = xpmResource.Job
radius_Client.EndPoint = xpmEndPoint.epCurrent

 ' -> Url: https://api.xero.com/practicemanager/3.1/job.api/current

DEPRECATED Methods (v1.3.0)

xeroSetup (Method, Format, Resource, [XeroIdentifier])
    Method - {WebMethod}
    Format - {WebFormat}
    Resource - {xeroResource}
    XeroIdentifier - {String} OPTIONAL

Easy setup for Xero API request.


xpmSetup (Method, Format, Resource, EndPoint, [XeroIdentifier])
    Method - {WebMethod}
    Format - {WebFormat}
    Resource - {xpmResource}
    EndPoint - {xpmEndPoint}
    XeroIdentifier - {String} Optional.

Easy setup for Practice Manager API request.


ExportSettings () {String}

Export current API settings as Base64 encoded Json string.


LoadSettings (SavedSetting)
    SavedSetting - {String} | Base64 encoded Json string as created by ExportSettings.

Load saved settings to API client.