Native REST, how to handle json error response when using import mapping

2
Hello, When using the native Rest functionality how should I handle/process the json response in case of an error. For example when all goes well I receivethe following JSON: {"data":{"result":"Created","userId":"1","expireIn":1800} But if for whatever reason the webservice cannot process my request correctly it will return another JSON string for example : {"errors":[{"field":"Email","type":"Format","details":"Email","errorMessage":"Invalid e-mail address","message":"Invalid e-mail address"}]} When setting the response to "Import mapping for the entire response" I cannot get this error JSON, the created objects exist but with no data (which is logical, but I cannot get the error message). Does anyone know how to do this? Thanks
asked
2 answers
2

Thanks for posting the work around!

answered
1

I found a way. The restservice response as string instead of import mapping. Then check the contents of the string, after that use different import mappings for the different json strings.

I hope there will be a more direct way in the future.

answered