Base solution for your next web application
Spring Sale!
Time Offer!
XXdays : XXhrs : XXmin : XXsec
Open Closed

Custom response codes (not 200) #758

owen84 created

is it possible to return different status codes like:

400 - Bad Request 401 - Unauthorized 402 - Payment Required 403 - Forbidden 404 - Not Found

using the dynamic api implementation when raising and returning an exception?

ps - awesome product!

1 Answer(s)
  • 0
    hikalkan created
    Support Team


    Dynamic API layer is designed for who just want to use application service methods easily from javascript side. As I understand, you want to expose services as API to 3rd party companies. You can direcly create regular Web API controllers in this case.

    More info: ABP does it in single place: AbpExceptionFilterAttribute class (exactly here: <a class="postlink" href=""> ... ute.cs#L67</a>). And registers it here: <a class="postlink" href=""> ... ule.cs#L84</a> So, theorically, you may create your own exception handler (by copying it and change), remove AbpExceptionFilterAttribute from Filters and add your own. Then you can check exception type and return appropriate code.

    As alternative, you can create an issue on Github. We can consider it to include in next versions.

    Have a nice day.