Base solution for your next web application
Open Closed

Change API error wrapping format #9513


User avatar
0
samara081 created

Hi,

I need to do minor changes for some api response exception wrapping, from

{
  "result": null,
  "targetUrl": null,
  "success": false,
  "error": {
    "code": 0,
    "message": "Error Message",
    "details": null,
    "validationErrors": null
  },
  "unAuthorizedRequest": false,
  "__abp": true
}

to be

{
  "result": null,
  "targetUrl": null,
  "IsSuccess": false,
  "error": {
    "code": 0,
    "message": "Error Message",  
  },
  "__abp": true
}

Is their any way to do it?


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    These properties are used in many methods, You should not change it for no particular reason.

    Can you share the reason?

  • User Avatar
    0
    samara081 created

    We just need it for a few APIs, as these APIs are used by specific client system as integration points. and this client require us to change the error format. i know the client should change it, however we are enforced by the customer to change it from our side

  • User Avatar
    0
    maliming created
    Support Team

    Hi

    You can consider to use the DontWrapResult .

    https://aspnetboilerplate.com/Pages/Documents/Javascript-API/AJAX?#wrapresult-and-dontwrapresult-attributes