createAccount
Creates a new chart of accounts
/Accounts
Usage and SDK Samples
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;
import java.io.File;
import java.util.*;
public class AccountingApiExample {
private AccountingApi apiInstance;
public static void main(String[] args) {
String accessToken = "YOUR_ACCESS_TOKEN";
ApiClient defaultClient = new ApiClient();
apiInstance = AccountingApi.getInstance(defaultClient);
String xeroTenantId = 'YOUR_XERO_TENANT_ID';
String idempotencyKey = 'KEY_VALUE';
Account account = new Account();
account.setCode("123456");
account.setName("FooBar");
account.setType(com.xero.models.accounting.AccountType.EXPENSE);
account.setDescription("Hello World");
try {
Accounts result = apiInstance.createAccount(accessToken, xeroTenantId, account, idempotencyKey);
System.out.println(result);
} catch (XeroException e) {
System.err.println("Exception when calling AccountingApi#createAccount");
e.printStackTrace();
}
}
}
Scopes
accounting.settings | Grant read-write access to organisation and account settings |
Parameters
Name | Description |
---|---|
xero-tenant-id* |
String
Xero identifier for Tenant
Required
|
Idempotency-Key |
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
Name | Description |
---|---|
account * |
Account
Account object in body of request
Required
|