Question

Ernst & Young LLP
IN
Last activity: 14 Aug 2025 6:32 EDT
Customize error response for 401 Authentication failure in Service REST
Hi Team,
Have configured a service REST in Pega and the client has asked to provide a specific response when 401 authentication/security error is returned from Pega when authentication fails.
There is an option provided in the Service REST rule to return 401 error for authentication/security error but not able to customize the error response format as requested from customer. Pega is sending the default error response for authentication failure. Is there any way to customize the error response.
Tried few solutions like the constant option for response but instead of JSON the error response is being of XML format, JSON transformation with JSON Data transform but not able to add constant values in the JSON data transform.
Tried to provide a clipboard type Data transform in the data transformation and inside it called the JSON data transform but the JSON was not getting generated correctly and was getting error in logs.
Attached the corresponding screenshots.
Help is appreciated.
Thanks,
Shiva