CPV Upload API Documentation
Base URL
https://example.com
GETPOST Upload EPC Records
Endpoint
GET /cpvUpload
POST /cpvUpload
Description
Uploads RFID/EPC scan data from a Feibot reader to a user's cpvUpload sub-collection in Firestore.
Request Parameters
| Parameter | Type | Required | Description |
uid | String | Yes | Firebase Auth UID of the user |
machineId | String | Yes | Reader/machine ID (e.g. U030) |
eventId | Integer | Yes | Event ID configured on the reader |
epcNum | Integer | Yes | Number of EPC records in this batch |
0 | String | Yes* | 1st EPC record: epcCode,date~time |
1 | String | Yes* | 2nd EPC record (same format) |
... | String | Yes* | Continue for each record up to epcNum - 1 |
t | Integer | No | Timestamp from the reader |
sign | String | No | Signature/random code for verification |
*Required for each index from 0 to epcNum - 1
Example GET Request
https://example.com/cpvUpload?uid=LFWjAtP7RDcggirMJ9oJbw4hl9q1&machineId=U030&eventId=2181&epcNum=3&0=1484187c,2023-09-21~19:05:35.460&1=1484187b,2023-09-21~19:05:35.952&2=14841878,2023-09-21~19:05:36.704&t=94962635&sign=6ecc73a23cd23865cf3d2ba725251bb1
Example POST Request
POST https://example.com/cpvUpload
Content-Type: application/json
{
"uid": "LFWjAtP7RDcggirMJ9oJbw4hl9q1",
"machineId": "U030",
"eventId": 2181,
"epcNum": 3,
"0": "1484187c,2023-09-21~19:05:35.460",
"1": "1484187b,2023-09-21~19:05:35.952",
"2": "14841878,2023-09-21~19:05:36.704",
"t": 94962635,
"sign": "6ecc73a23cd23865cf3d2ba725251bb1"
}
Responses
200 — Success
{
"success": true,
"data": {
"id": "auto_generated_document_id",
"cUsersId": "users/LFWjAtP7RDcggirMJ9oJbw4hl9q1",
"cMachineId": "U030",
"cEventId": 2181,
"cEpcNum": 3,
"cEpcRecords": [
{ "epcCode": "1484187c", "dateTime": "2023-09-21 19:05:35.460" },
{ "epcCode": "1484187b", "dateTime": "2023-09-21 19:05:35.952" },
{ "epcCode": "14841878", "dateTime": "2023-09-21 19:05:36.704" }
],
"cT": 94962635,
"cSign": "6ecc73a23cd23865cf3d2ba725251bb1",
"cDateCreated": "2025-04-16T15:30:00.000Z",
"cDateUpdated": "2025-04-16T15:30:00.000Z"
}
}
400 — Missing Required Fields
{
"error": "Missing required fields: uid, machineId, eventId, epcNum"
}
404 — User Not Found
{
"error": "No user found with uid: invalid_uid_here"
}
409 — Duplicate Upload
Returned when all fields (machineId, eventId, epcNum, t, sign) match an existing record.
{
"success": false,
"error": "Duplicate upload detected. This data already exists.",
"existingId": "existing_document_id"
}
500 — Server Error
{
"error": "error message details"
}
Firestore Schema
Collection Path
users/{uid}/cpvUpload/{auto_id}
Fields
| Field | Type | Description |
cUsersId | Doc Reference | Reference to users/{uid} |
cMachineId | String | Reader/machine ID |
cEventId | Integer | Event ID |
cEpcNum | Integer | Number of EPC records |
cEpcRecords | List (epcRecords) | Array of EPC record objects |
cT | Integer | Reader timestamp |
cSign | String | Signature/verification code |
cDateCreated | DateTime | Server timestamp when created |
cDateUpdated | DateTime | Server timestamp when updated |
epcRecords Object
| Field | Type | Description |
epcCode | String | Chip/EPC code (e.g. 1484187c) |
dateTime | String | Date and time of scan (e.g. 2023-09-21 19:05:35.460) |
Notes
- The API accepts both GET and POST requests
- GET is used by the Feibot reader (data in URL query string)
- POST is recommended for app usage (data in request body)
- Duplicate detection uses:
machineId + eventId + epcNum + t + sign
- No authentication token is required — the
uid parameter identifies the user
- CORS is enabled for cross-origin requests