Hackathon project on Blockchain.
-
POST /api/auth/registerRegister a new user. Expected Payload:{ "username": "string (required)", "email": "string (required, valid email)", "password": "string (required, min 6 chars)" } -
POST /api/auth/loginLogin and receive an authentication token. Expected Payload:{ "email": "string (required, valid email)", "password": "string (required)" }
These endpoints require a valid JWT token in the Authorization header (Bearer <token>).
-
GET /api/user/profileRetrieve the profile details of the currently authenticated user. Expected Payload: None (uses token from header). -
POST /api/batchesRegister a new batch. Expected Payload:{ "produce_type": "string (required)", "quantity": "number (required, > 0)", "unit": "string (required)", "harvest_date": "string (ISO 8601 Date, required)", "location": "string (required)", "farm_name": "string (optional)" } -
POST /api/batches/:batchID/eventsRecord a new event for a specific batch. Expected Payload:{ "event_type": "string (required, e.g. registration, transport, quality_check, transfer, sale)", "event_data": { "key": "value (dynamic JSON object, required)" } }
-
GET /api/marketplaceFetch all products currently available on the market (e.g. status isregisteredorin_transit). Expected Payload: None. -
GET /api/trace/:batchIDRetrieve traceability information for a specific batch. Publicly accessible so buyers can scan QR codes. -
GET /qrcodes/:filenameServe a QR code image file.