Library
FD1 Data Endpoint
This endpoint allows you to fetch tables of data and also filter and sort the results.
Requesting 3 products by pid, and having a custom JSON output object.
{
a: "fd1.data",
v: {
table: "products[1234;789;441]"
},
qo: {
pid:true,
idstring: "physkey",
description: true
}
}
Requesting all products with pid between 1200 and 2000. A default collection of fields is returned
{
a: "fd1.data",
q: {
"pid(>=)": 1200,
"pid(<)": 2000
},
v: {
table: "products"
}
}
Selecting all products, that have been sold today AND belong to a specific single department. This might be the base of a 'products sold today' report
{
a: "fd1.data",
v: {
table: "products[r_depid=@depid][sold today]",
param: {
depid: 2
}
}
}
Requesting a list of all known departments, and including as additional fields:
- Number of products assigned to each department
- Number of items sold today
- Total revenue for items sold today
{
a: "fd1.data",
rq: "deptsum",
v: {
table: "departments"
},
qo: {
depid: true,
description: true,
cnt: "products[r_depid=@depid]._count",
cnt_sold_today: "products[r_depid=@depid][sold today]._count",
revenue_today: "products[r_depid=@depid][sold today]._sum(line.totalprice)"
}
}
Potential Output
{
"rp":"deptsum",
"data": {
rows: [
{
depid: 17,
description: "Fresh",
cnt: 283,
cnt_sold_today: 3411,
revenue_today: 24573.29
},
{
depid: 22,
description: "Cleaning",
cnt: 74,
cnt_sold_today: 42,
revenue_today: 381.10
},
...
]
}
}