I have a requirement to customize OTK error message.
OTK Version : 4.1
Gateway version : 9.2
e.g.
- OTK error message default error message format is :
{
"error":"invalid_request",
"error_description":"Custom error description"
}
2. Expecting OTK error message error message format is :
{
"error": {
"status": "400",
"errors": [
{
"fields": "["invalid_request"]",
"key": "error. missingDuplicate.parameters"
}
]
},
"data": {}
}
Please have a look at below approach and let me know how to achieve it.
Approach 1 : Override message creation in "OTK Fail with error message"
Approach 2 : Capture error message in "Global Message completed" and modify format
Approach 3 : Able to modify error message for each status code in customizations/#OTK Fail with error message
Challenges :
- challenges in Approach 1 : how to disable "OTK Cache Store" and override error.msg context variable.
- challenges in Approach 2 : Unable to get error message as part of ${response.mainpart} or ${resp.mainpart} and unable to expose as "Export Variables from Fragment" in customizations/#OTK Fail with error message.
- challenges in Approach 3 : Have to override all error code policy assertions, which is not a good practice.
I failed to achieve even though, was trying to modify "#OTK Cache Look Up Customization / "#OTK Cache Store Customization" . Please share your inputs.