Working with the AccountRight Live API
If using the SDK to talk to the AccountRight API locally on the default base url http://localhost:8080/accountright the best place to start here is fetching a list of company files available inside the AccountRight library on the desktop.
The following snippet of code includes the services and contracts required to do this (c# example), here we are initialising an instance of the ApiConfiguration class along with a call to the CompanyFileService which is used to initialise a service that can fetch company files in a synchronous fashion (SDK also supports making calls in an asynchronous fashion).
var configuration = new ApiConfiguration("http://localhost:8080/accountright");
var cfService = new CompanyFileService(configuration);
var companyFiles = cfService.GetRange();
Next step in the flow is to select a company file that supports v2 contracts for the AccountRight API - anything from 2013.3 and up will do here.
var companyFile = companyFiles.FirstOrDefault(x => new Version(x.ProductVersion) >= new Version("2013.3"));
The company file credentials are an AccountRight requirement with the SDK providing the CompanyFileCredentials class to encapsulate these. For our example the company file login details in use are username: Administrator with no password on the admin account.
var credentials = new CompanyFileCredentials("Administrator","");
Now you are ready to start accessing resources directly from the API
var accountService = new AccountService(configuration);
var accounts = accountService.GetRange(companyFile,null,credentials);
Copyright © 2015 MYOB Technology Pty Ltd