3.4 KiB
3.4 KiB
Send Individual Employee E-Card Mail API
Sends the E-Card download mail to a single employee (Self relationship only).
Controller: EmployeeRestController::sendMailForIndividualEmployeeEcard
Method: POST
Endpoint
POST /employeeRest/sendMailForIndividualEmployeeEcard
Authentication
JWT token is required. This endpoint is available only in the authenticated route group.
| Filter | Description |
|---|---|
GlobalPostFileUploadGuard |
POST upload guard |
ratelimit |
Rate limiting |
appSignature |
App signature validation |
authJWT |
JWT token validation |
Required Headers
| Header | Required | Description |
|---|---|---|
Content-Type |
Yes | application/json |
App-Signature |
Yes | Must match server APP_SIGNATURE from .env |
Authorization |
Yes | JWT token in format Bearer <token> |
Example Headers
Content-Type: application/json
App-Signature: <your_app_signature>
Authorization: Bearer <jwt_token>
Request Body (JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
emp_policy_id |
integer | Yes | Employee policy ID (employee_polices.id) |
client_policy_id |
integer | Yes | Client policy ID |
Example Request
{
"emp_policy_id": 12345,
"client_policy_id": 678
}
cURL Example
curl -X POST "https://<base_url>/employeeRest/sendMailForIndividualEmployeeEcard" \
-H "Content-Type: application/json" \
-H "App-Signature: <your_app_signature>" \
-H "Authorization: Bearer <jwt_token>" \
-d '{
"emp_policy_id": 12345,
"client_policy_id": 678
}'
Success Response
HTTP Status: 200
{
"status": true,
"code": 200,
"message": "Mail sent successfully",
"result": {}
}
Error Responses
Missing emp_policy_id
HTTP Status: 200
{
"status": false,
"code": 404,
"message": "emp_policy_id is required"
}
Missing client_policy_id
HTTP Status: 200
{
"status": false,
"code": 404,
"message": "client_policy_id is required"
}
Mail Send Failed
HTTP Status: 200
{
"status": false,
"code": 404,
"message": "Failed to sent mail.",
"result": {}
}
Missing / Invalid Token
HTTP Status: 401 or 403
{
"status": 401,
"message": "Token is Invalid"
}
Invalid App Signature
HTTP Status: 403
{
"status": false,
"message": "Forbidden: Invalid App Signature"
}
Notes
emp_policy_idis the employee policy record ID, not the employee master ID.- Mail is sent only when E-Card notification is enabled for the client.
- Employee must be active with a valid corporate email and TPA ID.
- This API uses the same logic as
EmployeeController::send_mail_for_individual_employee_ecard.
Route Registration
Defined in app/Config/Routes.php:
$routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'ratelimit', 'appSignature', 'authJWT']], function ($routes) {
$routes->post("sendMailForIndividualEmployeeEcard", "EmployeeRestController::sendMailForIndividualEmployeeEcard");
});
Source
Implementation: app/Controllers/EmployeeRestController.php → sendMailForIndividualEmployeeEcard()
Service: app/Controllers/EmpDataServiceController.php → sendMailForDownloadingECard()