I have a requirement to connect CRM to various custom websites via API. CRM comes with a WebAPI, but it seems like a dumb I/O interface rather than something that can incorporate complex business logic and give detailed feedback on why the request will not be accepted. Sure, you can run workflows and business rules after the request is accepted (which have their limitations due to the UI-based configuration), but that won't help with giving useful feedback to the sender if those workflows fail.
Some business requirements/logic could be:
- required fields (different fields required in different scenarios)
- check if a related record has a certain value before accepting the request.
- performing calculations that depend on various record attributes
- giving custom responses akin to that of custom REST API
The alternative to fully relying on the CRM's WebAPI is to create an intermediate REST API that will handle the business logic, validation, and custom responses. I expect that there are two options: C# plugin powered by the CRM SDK, or a custom REST API server that uses the WebAPI. If those are the options, which one is better? Is the close coupling of the REST API as a CRM plugin worth the benefits?