Question
HTTP response from REST API
Hi all, I'm facing a strange situation using Pega API, that as not happening before.
I'm using Pega API to cretate test some business scenarios.
One of the scenarios should check if the response is like below... Validating if the property was not fulfilled...
{
"pxObjClass": "Pega-API-CaseManagement-Assignment",
"errors": [
{
"ID": "Pega_API_055",
"message": "Validation message found.",
"pxObjClass": "Pega-API-Error",
"ValidationMessages": [
{
"Path": ".ClientRequest.Content",
"pxObjClass": "Pega-API-Error-ValidationMessage",
"ValidationMessage": "This field may not be blank"
}
]
}
]
}
It was working fine.
But after some updates the response from the REST request I'm getting is an HTML similar that one...
<html><head> <title> Bad request </title> </head> <body> <p> We are sorry, but the request you have sent does not match the expected format. </ p > <p> If you think the request content is correct, please try again. </p> </body> </html>
When I check the log I see that message. That shows that the REST error code I was expecting is there.
API error for C204810: Pega_API_055: .ClientRequest.Content: This field may not be blank.
Looks like now, when something goes wrong (doesn't matter is its a real bad request or a validation) instead of replying as JSON, Pega is sending that generic HTML message.
Does anyone have any idea what may be going on? ***Edited by Moderator Kayla to update Platform Capability tags****
Hi Marco,
I've seen this occur when middleware between Pega and the service consumer detects the a HTTP response code that is not 200 and overrides the response body issued by Pega with its own HTML error page.
Is there a way you can send the same request directly to the Pega server - bypassing any reverse proxy servers or load balancers - and see whether Pega itself is continuing to send a JSON body for error scenarios? If you can prove that then your issue is somewhere between you and Pega, and not Pega itself.