Recipes
Here are a few recipes for common API use-cases.
Setting up HttpClient
To interact with the REST API, you can use the built-in .NET HttpClient. Remember you will first need to request for a token.
Creating a client
To create a client, first create an entity, then make it play the role of a client.
var entityId = await CreateEntity();
Console.WriteLine($"Created {entityId}");
var clientId = await CreateClient(entityId);
Console.WriteLine($"Created {clientId}");
private static async Task<string?> CreateEntity()
{
var request = new HttpRequestMessage(HttpMethod.Post, "v1/entities") {
Content = new StringContent(
JsonSerializer.Serialize(new {
entityType = "Individual",
firstName = "Gordon",
lastName = "Smith",
currency = "AUD",
email = "john.smith@domain.local",
}), null, "application/json")
};
return await Send(request, result => {
var data = result.RootElement.GetProperty("data");
return data.GetProperty("id").GetString();
});
}
static async Task<string> CreateClient(string entityId)
{
var request = new HttpRequestMessage(HttpMethod.Post, "v1/clients") {
Content = new StringContent(
JsonSerializer.Serialize(new {
entityId = entityId
}), null, "application/json")
};
return await Send(request, result => {
var data = result.RootElement.GetProperty("data");
return data.GetProperty("id").GetString();
});
}Creating a matter
To create a matter, all you need is a clientId and a title. However, this matter does not become an active matter yet until an authorised user has assigned the appropriate matter type, acting and responsible persons, billing rates and any other required setup in accordance with the firm’s internal policies.
static async Task<string> CreateMatter(string clientId)
{
var request = new HttpRequestMessage(HttpMethod.Post, "v1/matters") {
Content = new StringContent(
JsonSerializer.Serialize(new {
clientId = clientId
}), null, "application/json")
};
return await Send(request, result => {
var data = result.RootElement.GetProperty("data");
return data.GetProperty("id").GetString();
});
}Posting a work item
Create a work item based
Post a journal entry
A common use case is to enter a posting to the general ledger. For example, recording salary paid into the general ledger.
Subscribing to general ledger posting
You can use a webhook to push all general ledger postings to an external system.
Subscribing to invoice issued events
You can use a webhook to be notified whenever an invoice is issued.
Query profit and loss data
Using GraphQL interface to access profit and loss data.
Query for invoice list
Use the API to look for invoices and access its line items.