Problem details is a standard way to communicate error details in HttpResponse, defined in rfc 7807. Standard ProblemDetails Properties:
Type
: URI identifying problem typeTitle
: Short error descriptionStatus
: HTTP status codeDetail
: Specific error explanationInstance
: URI identifying specific error occurrence
Problem details is automatically integrated with .net core APIs. When we return the BadRequest we generally get response with problem details.
// controller method
return BadRequest();
// response
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "Bad Request",
"status": 400,
"traceId": "00-2d4948694b0f223f7f5dff215b42481b-0288bb95d7604783-00"
}
The same thing happens when we return the NotFoundException.
[Read More]