Question

163
Views
MaximI83 Member since 2018 16 posts
Alfa Bank
Posted: 1 year ago
Last activity: 1 year 1 month ago
Closed

Pega API return several errors

Hello

I have a requirement to create an API to create a case, but in addition to the fields used in the Pega API cases / {id}: "caseTypeID", "processID", "parentCaseID", I need to fill in all the case data in the "content" field and check data for correct input. I will costomize pzCreateCase activity to check the data passed in the request body in the "content" field. To do this, I created a decision table and use it in the Property-Map-DecisionTable method to get the error ID and its description.

An error ID is written to Param.StatusCode during data validation. In the decision table by the error ID, we get a description of the error and the status for a response.

My custom error number is "Pega_API_047" with status code 454. The error description is written to the activity parameter from where the Property-Map-DecisionTable method is called. The name of the parameter is Param.Error. And everything works well. Below is an example of server response when testing API in Postman.

But I need to return some errors in the list of errors. For example:
{
"pxObjClass": "Pega-API-CaseManagement-Case",
"errors": [
{
"ID": "Pega_API_047",
"message": "Incorrect type of cargo; ",
"pxObjClass": "Pega-API-Error"
}
{
"ID": "Pega_API_048",
"message": "Incorrect currency; ",
"pxObjClass": "Pega-API-Error"
}
{
"ID": "Pega_API_049",
"message": "Incorrect declaration number; ",
"pxObjClass": "Pega-API-Error"
}
]
}

How can I do this, please tell me

Low-Code App Development Low-Code App Development Dev/Designer Studio Data Integration Java and Activities Data Integration
Moderation Team has archived post
Share this page LinkedIn