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

ParameterTypeRequiredDescription
uidStringYesFirebase Auth UID of the user
machineIdStringYesReader/machine ID (e.g. U030)
eventIdIntegerYesEvent ID configured on the reader
epcNumIntegerYesNumber of EPC records in this batch
0StringYes*1st EPC record: epcCode,date~time
1StringYes*2nd EPC record (same format)
...StringYes*Continue for each record up to epcNum - 1
tIntegerNoTimestamp from the reader
signStringNoSignature/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

FieldTypeDescription
cUsersIdDoc ReferenceReference to users/{uid}
cMachineIdStringReader/machine ID
cEventIdIntegerEvent ID
cEpcNumIntegerNumber of EPC records
cEpcRecordsList (epcRecords)Array of EPC record objects
cTIntegerReader timestamp
cSignStringSignature/verification code
cDateCreatedDateTimeServer timestamp when created
cDateUpdatedDateTimeServer timestamp when updated

epcRecords Object

FieldTypeDescription
epcCodeStringChip/EPC code (e.g. 1484187c)
dateTimeStringDate and time of scan (e.g. 2023-09-21 19:05:35.460)

Notes