Skip to main content

Employee API Response and Error Model

Summary

Direct endpoints use ApiResponse<T> and translate application Result<T> values to HTTP status codes. Compatibility endpoints return plain legacy-shaped JSON and simpler empty or string error bodies. RFC Problem Details is Not implemented for these mappings.

Audience

  • Frontend and integration developers
  • QA engineers
  • Support engineers interpreting safe failures

Reference Content

The following envelope and mapping tables are the confirmed public response reference for direct and compatibility Employee endpoints.

Direct response envelope

{
"success": true,
"message": "Success",
"data": {},
"correlationId": "safe-correlation-id",
"errors": null
}

Properties are success, message, data, optional correlationId, and optional errors (a map of string arrays). Validation messages are grouped under validation; missing tenant context uses the tenant key. Consumers should use the HTTP status and success, not parse message text.

Confirmed mapping

Source/resultDirect HTTPDirect bodyCompatibility HTTP/body
Success200ApiResponse<T>200, plain DTO/list/string
Create success201ApiResponse<EmployeeResponse> plus Location200, plain DTO
Not found404Failure envelope404, empty body
Conflict409Failure envelope400, plain error string
Validation400Failure envelope with errors.validation400, plain error string
Missing tenant, direct400Failure envelope with errors.tenantOutcome varies; Requires confirmation
Other handled result400Failure envelope400, plain error string
Unauthorized / forbiddenRequires confirmationNo Employee-specific 401/403 mappingRequires confirmation
Unhandled errorRequires confirmationNo public Employee-specific contractRequires confirmation

Examples

Validation failure:

{
"success": false,
"message": "Validation failed.",
"data": null,
"correlationId": "safe-correlation-id",
"errors": {"validation": ["Employee name is required."]}
}

Compatibility invalid identifier:

"employee id is not a valid GUID."

The exact message includes the supplied safe identifier. Do not expose submitted personal data in support records.

Source References

  • microservices/src/contracts/Common/ApiResponse.cs
  • microservices/src/employee-service/Application/Common/Cqrs.cs
  • microservices/src/employee-service/Api/EmployeeDirectEndpoints.cs
  • microservices/src/employee-service/Api/EmployeeCompatibilityEndpoints.cs

See Also

Keywords

  • API response
  • Result translation
  • Error mapping

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly