Sales Invoice Report (Developer Guide)
Overview
This document describes the REST API endpoints available under the Custom Report module. It covers authentication requirements, available query parameters, response formats, and integration examples for the fetch-si endpoint.
Authentication
All endpoints require a valid JWT Bearer token obtained through the login endpoint. Requests without a token return 401 Unauthorized.
Login Endpoint
|
Method |
POST |
|
URL |
http://localhost:3005/api/auth/login-user |
Request Body (JSON)
{
"username": "<your_username>",
"password": "<your_password>"
}
Success Response 200 OK
{
"accessToken": "eyJhbGci..."
}
Token Details
|
Token Type |
Lifetime |
Secret Config Key |
|
Access Token |
2 hours |
JWT_ACCESS_SECRET |
|
Refresh Token |
7 days |
JWT_REFRESH_SECRET |
How to Use the Token
Add the Authorization header to every subsequent request:
Authorization: Bearer <accessToken>
Fetch SI Report Endpoint
Retrieves Sales Invoice (SI) report data for a given date range. Only items matching the optional filter parameters are returned.
|
Method |
GET |
|
URL |
http://localhost:3005/api/custom-report/fetch-si |
|
Auth |
Bearer Token required |
Query Parameters
|
Parameter |
Type |
Required |
Description |
|
from |
string (date) |
Yes |
Start date of the report range. Format: YYYY-MM-DD. Example: 2026-01-01 |
|
to |
string (date) |
Yes |
End date of the report range. Format: YYYY-MM-DD. Example: 2026-01-30 |
|
area |
string |
No |
Filter results by area/branch. Example: AREA 1 |
|
store |
string |
No |
Filter results by store code. Example: SNE |
|
search |
string |
No |
Search by salesman name or stock number. Example: SINAGOTE (salesman) or 46-40 (stock number) |
Example Requests
Minimal — Date Range Only
GET /api/custom-report/fetch-si?from=2026-01-01&to=2026-01-30
Authorization: Bearer <accessToken>
With Search Filter
GET /api/custom-report/fetch-si?from=2026-01-01&to=2026-01-30&search=SINAGOTE
Authorization: Bearer <accessToken>
Response Codes
|
Code |
Status |
Meaning |
|
200 |
OK |
Request succeeded. SI report data returned in response body. |
|
400 |
Bad Request |
Missing or invalid query parameters (e.g., malformed date). |
|
401 |
Unauthorized |
No token provided, or the token has expired. Re-authenticate. |
|
500 |
Internal Server Error |
Unexpected server-side error. |