Question

200
Views
Close popover
Maxim Izvarin (MaximI83)
Alfa Bank

Alfa Bank
RU
MaximI83 Member since 2018 16 posts
Alfa Bank
Posted: August 12, 2019
Last activity: August 12, 2019
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 Enterprise Application Development Dev/Designer Studio Data Integration Java and Activities
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.