Hello,
We have a case that we need to call an external API which is not ABP module. Which layer should we place the service? I assume that we need to behave like it is a application service and create DTOs, interfaces accordingly. What is the best practice? Do you have an example?
Thanks.
1 Answer(s)
-
0
Hi,
It depends on your scenario, if your domain strictly coupled to that external service, you can even make HTTP request in a DomainService. But most of cases, it's an application logic and calling your external API in the Application layer much more accurate but still it depends on the logic.
As a best practise, I can suggest you to create a contracts or client package built as a new library and implement all the sending logic in that class library and consume it from your ABP aplication. You can easily generate HTTP Client methods by using NSwag or equivalent tools if the API provides Open API information by swager etc.