Tài liệu › Tham chiếu API › Báo cáo
Báo cáo
Báo cáo và chi phí công theo kỳ.
6 thao tác · gốc /api/v1/reports
/api/v1/reports/catalogDanh mục báo cáo kèm số khối người xem được thấy
report.viewThử trong API Explorer ▶Tham số
Không có tham số.
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/catalog" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
200 OK
[
{
"accessible": true,
"blocks": 1,
"chart": "…",
"code": "…",
"description": "…",
"group": "…",
"title": "…",
"visibleBlocks": 1
}
]/api/v1/reports/exports/{id}Trạng thái một lượt xuất: pending · running · completed · failed
report.exportThử trong API Explorer ▶Tham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
id | GUID | path | có | — |
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/exports/<id>" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
200 OK
{
"code": "…",
"completedAt": "2026-10-28T07:30:00Z",
"createdAt": "2026-10-28T07:30:00Z",
"downloadPath": "…",
"error": "…",
"expiresAt": "2026-10-28T07:30:00Z",
"fileName": "…",
"format": "…",
"id": "0190a3c2-5b1e-7c3d-8e4f-000000000001",
"sizeBytes": 1,
"status": "…",
"title": "…"
}/api/v1/reports/exports/{id}/fileTải tệp đã xuất (404 khi quá 24 giờ)
report.exportThử trong API Explorer ▶Tham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
id | GUID | path | có | — |
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/exports/<id>/file" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
Tuyến này chưa khai schema phản hồi — gọi thử trong API Explorer để xem hình dạng.
/api/v1/reports/labor-costChi phí nhân công theo thửa / mùa vụ
Theo NGÀY LÀM trong [from, to] (yyyy-MM-dd, tối đa 731 ngày). Mỗi dòng = (thửa, mùa vụ): lương theo thời gian đã chia theo công + khoán đã chốt. parcel_id null = không gắn thửa; season_id null = ngoài mùa vụ. freshness = lần cuối nhận dữ liệu từ từng nguồn (null = nguồn CHƯA từng gửi, không phải 0đ).
report.viewThử trong API Explorer ▶Tham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
from | date | query | không | — |
to | date | query | không | — |
parcel_id | GUID | query | không | — |
season_id | GUID | query | không | — |
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/labor-cost" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
200 OK
{
"freshness": {
"lastPayrollFinalizedAt": "2026-10-28T07:30:00Z",
"lastPieceworkReceivedAt": "2026-10-28T07:30:00Z",
"lastSeasonSyncedAt": "2026-10-28T07:30:00Z"
},
"from": "2026-10-28",
"rows": [
{
"costPerKg": 1,
"cropName": "…",
"parcelCode": "…",
"parcelId": "0190a3c2-5b1e-7c3d-8e4f-000000000001",
"pieceworkCost": 1,
"pieceworkQuantities": [
{
"quantity": 1.5,
"unit": "…"
}
],
"seasonId": "0190a3c2-5b1e-7c3d-8e4f-000000000001",
"seasonName": "…",
"timeCost": 1,
"totalCost": 1,
"workUnits": 1.5,
"workerCount": 1,
"yieldKg": 1.5
}
],
"to": "2026-10-28",
"totals": {
"pieceworkCost": 1,
"timeCost": 1,
"totalCost": 1,
"workUnits": 1.5,
"workerCount": 1
}
}/api/v1/reports/queryChạy báo cáo bằng GET; thiếu to = hôm nay UTC+7, thiếu from = to - 29 ngày
report.viewThử trong API Explorer ▶Tham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
code | string | query | không | — |
from | date | query | không | — |
to | date | query | không | — |
grain | string | query | không | — |
compare | string | query | không | — |
includeSample | bool | query | không | — |
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/query" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
200 OK
{
"asOf": "2026-10-28T07:30:00Z",
"blocks": [
{
"chart": "…",
"dataset": "…",
"drill": "…",
"groupBy": [
"…"
],
"hasSample": true,
"hidden": true,
"id": "…",
"kpis": [
{
"compare": 1.5,
"deltaPct": 1.5,
"key": "…",
"value": 1.5
}
],
"measures": [
{
"good": "…",
"key": "…",
"label": "…",
"op": "…",
"unit": "…"
}
],
"reasonCode": "…",
"rows": [
{
"date": "2026-10-28",
"dims": {
"key": null
},
"id": "…",
"values": {
"key": null
}
}
],
"source": "…",
"span": 1,
"status": "…",
"title": "…",
"totals": {
"key": 1.5
},
"truncated": true,
"type": "…",
"updatedAt": "2026-10-28T07:30:00Z"
}
],
"code": "…",
"description": "…",
"group": "…",
"hasSample": true,
"hidden": [
"…"
],
"labels": {
"key": {
"key": "…"
}
},
"period": {
"compareFrom": "2026-10-28",
"compareTo": "2026-10-28",
"from": "2026-10-28",
"grain": "…",
"to": "2026-10-28"
},
"summaryFocus": [
"…"
],
"title": "…"
}/api/v1/reports/traceTruy xuất ngược nhiều tầng từ một nút (phiếu thu hoạch, phiếu khoán, chứng từ, phiếu lương, phiếu bán…)
kind: harvest_record · piecework_sheet · qr_code · trace_bundle · cash_document · payout_batch · produce_sale · payroll_line · payroll_period. id hoặc key (số phiếu). level âm = phía lên (gốc), dương = phía xuống. Bước thiếu quyền ⇒ restricted (không tên/số), chuỗi dừng ở đó.
report.viewThử trong API Explorer ▶Tham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
kind | string | query | không | — |
id | string | query | không | — |
key | string | query | không | — |
depth | int | query | không | — |
Ví dụ
curl -X GET "https://api-prod.nextfarm.vn/api/v1/reports/trace" \
-H "Authorization: Bearer <ACCESS_TOKEN>"Phản hồi mẫu
200 OK
{
"edges": [
{
"from": "…",
"to": "…"
}
],
"nodes": [
{
"id": "…",
"kind": "…",
"level": 1,
"node": {
"amount": 1.5,
"date": "2026-10-28",
"facts": [
{
"label": null,
"value": null
}
],
"flag": "…",
"flagOf": {
"id": "…",
"key": "…",
"kind": "…"
},
"href": "…",
"id": "…",
"key": "…",
"kind": "…",
"service": "…",
"status": "…",
"subtitle": "…",
"title": "…",
"unit": "…"
},
"ref": "…",
"restricted": true,
"service": "…",
"sourceError": true
}
],
"root": "…",
"truncated": true
}