Report sales against target
Use this recipe to show how your organisation is doing against its sales
and output targets in another system, such as a wallboard, a chat channel
or a business intelligence (BI) tool. You read the dashboard figures on a
timer and compare each actual with its pace.
Every request in this recipe sends your API key in an
Authorization: Bearer <key> header. Paths are relative to
https://<host>/api/v1, and the examples show the full path. This recipe
only reads, but GET /dashboard is in beta, so it can change in any way,
at any time, until it's marked stable. Learn more about
beta operations.
You need the scope sales:read.
Read the figures#
GET /api/v1/dashboard
The response has the day it's for in date, and two sets of figures,
sales and output, each with day, month and year. Every amount is
in your base currency, whose ID is in currencyId. To show its code, such
as GBP, look the ID up once with
List all currencies, which
needs the scope reference:read.
Compare the figures with the targets#
For the month and the year, compare actual with pace, the part of the
target up to and including today:
actualat or abovepace: you're on course to reachtarget.actualbelowpace: you're behind bypaceminusactual.
For today, compare actual with target. A day that isn't a working day,
or is a closed day, has a target of 0. Your working days are in
workingWeek in GET /settings, and your closed days are listed by
GET /closed-days. Both need the scope reference:read. If every target is 0, your
organisation hasn't set targets: an admin sets them in Omono's settings.
Read them again#
Read the figures again once a minute or less often. Omono keeps the figures for about 30 seconds after it works them out, and each request counts as 5 against your organisation's rate limit, as Dashboard figures explains.
Omono decides what today is in your organisation's time zone, returned in
timeZone. When date changes, a new day has started, and the day
figures start again from 0. On the first day of a month, the month
figures start again too.