ballerinax/xero.projects Ballerina library

2.0.0

Overview

Xero is a cloud-based accounting platform for small and medium-sized businesses. Its Projects API lets you track time and costs against client work, and covers projects, the tasks within them, time entries, and the users who can be assigned work.

The Xero Projects connector provides a Ballerina client for version 2.0 of the Xero Projects API. It lets you create and update projects, manage tasks and their charge rates, log and edit time entries, and list the users available for project work from your integrations.

Key features

  • Create, retrieve, update and close projects for your contacts
  • Manage project tasks with time-based, fixed or non-chargeable rates
  • Log, update and delete time entries and filter them by user, task, date or invoice
  • List project users and page through large result sets

Setup guide

To use the Xero Projects connector, you need a Xero app that can call the Projects API for your organisation.

  1. Sign in to the Xero developer portal and select New app.

  2. Enter an app name and company or application URL, choose the Web app integration type, and add a redirect URI for your application.

  3. Open the Configuration page of the app and copy the Client id. Generate a Client secret and copy it.

  4. Run the OAuth 2.0 authorization code flow against https://login.xero.com/identity/connect/authorize requesting the projects, projects.read and offline_access scopes. Exchange the returned code at https://identity.xero.com/connect/token for an access token and a refresh token.

  5. Call GET https://api.xero.com/connections with the access token and copy the tenantId of the organisation you want to work with. Every operation of the connector takes it as the xeroTenantId header.

Quickstart

To use the xero.projects connector in your Ballerina application, update the .bal file as follows:

Step 1: Import the connector.

Copy
import ballerinax/xero.projects;

Step 2: Create a Config.toml file with your credentials.

Copy
clientId = "<client-id>"
clientSecret = "<client-secret>"
refreshToken = "<refresh-token>"
tenantId = "<xero-tenant-id>"

Step 3: Create a client and read the configuration.

Copy
configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;
configurable string tenantId = ?;

projects:Client projectsClient = check new ({
    auth: {
        clientId,
        clientSecret,
        refreshToken
    }
});

Step 4: List the projects of your organisation.

Copy
public function main() returns error? {
    projects:ProjectList _ = check projectsClient->listProjects({xeroTenantId: tenantId});
}

Examples

The Xero Projects connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:

  1. Project time logging - Create a project for a contact, add a chargeable task, log time against it and read the entries back.

  2. Project progress report - Compare the estimated and logged minutes of every in-progress project.

Import

import ballerinax/xero.projects;Copy

Other versions

See more...

Metadata

Released date: 1 day ago

Version: 2.0.0

License: Apache-2.0


Security

Direct vulnerabilities: No known direct vulnerabilities

Indirect vulnerabilities: 

Checked on 2026-11-21 via OSV.dev


Compatibility

Platform: any

Ballerina version: 2201.12.0

GraalVM compatible: Yes


Pull count

Total: 45

Current verison: 1


Weekly downloads


Source repository


Keywords

Vendor/Xero

Area/Finance & Accounting

Type/Connector


Contributors