This document provides a detailed description of each API endpoint in the FaceRec project, including inputs, outputs, and how various scenarios are handled.
Endpoint: /api/face-entry/create
Method: POST
Description: Receives an image and metadata to create a new face entry.
Request Body:
{
"Employeecode": "string",
"Name": "string",
"gender": "string",
"Department": "string",
"Image": "base64 encoded image"
}
Response:
- Success (201 Created):
{ "message": "Face entry created successfully", "id": "unique identifier" }
- Error (400 Bad Request):
{ "error": "Invalid input data" }
Endpoint: /api/face-entry/data
Method: GET
Description: Retrieves the list of all face entries.
Response:
- Success (200 OK):
[ { "id": "unique identifier", "Employeecode": "string", "Name": "string", "gender": "string", "Department": "string", "time": "timestamp", "embeddings": "array of numbers", "Image": "base64 encoded image" }, ... ]
Endpoint: /api/face-entry/update/{Employeecode}
Method: PUT
Description: Updates the details of an existing face entry.
Request Body:
{
"Name": "string",
"gender": "string",
"Department": "string"
}
Response:
- Success (200 OK):
{ "message": "Face entry updated successfully" }
- Error (404 Not Found):
{ "error": "Face entry not found" }
Endpoint: /api/face-entry/delete/{Employeecode}
Method: DELETE
Description: Deletes a specific face entry by employee code.
Response:
- Success (200 OK):
{ "message": "Face entry deleted successfully" }
- Error (404 Not Found):
{ "error": "Face entry not found" }
- 400 Bad Request: Returned when the input data is invalid or missing required fields.
- 404 Not Found: Returned when the requested resource (face entry) is not found in the database.
- 500 Internal Server Error: Returned when there is an unexpected error on the server.
This documentation provides a comprehensive guide to using the FaceRec API. Following these guidelines will help ensure proper integration and usage of the API endpoints.