You can create Logic Apps and Flow workflows that trigger on receipt of a Http request and optionally receive a Json payload. This technique can be used as an integration pattern in a B2B enviroment. You can design your Json scheme specifically for your partners so that is is easy to use and understand. This provides your integation partners with an API that abtracts the complexities and business logic of the underlying platforms from the calling system. This is a good way of creating an API for Dynamics 365 rather than proving direct access to the Dynamics Web API which gives unrestricted accesss to the underlying entities.
In this example I created a Logic App workflow accepts a Json message use the Json data received to creates a contact and account record in Dynamics 365.
I created this workflow by starting with a blank workflow and added a Request trigger and entered the sample Json below to generate the payload schema.
I then added actions to the workflow to create a contact and account record in Dynamics 365 using the data in the Json payload. In the create account action I have used the company parameter from the Http request Json and set the primary contact to the contact created in the first action.
I can now provide my integration partner with details of the Url and the Json schema to call the Workflow. The issue with this is that there is no validation of the Json posted and if the endpoint is triggered without a payload we end up with empty records in Dynamics 365. A better way of handling this is to use a Json Schema tool to create a schema with validation. I created my own Json schema making the three fields required and used this schema in my Logic App instead of the previously auto generated schema.
I then selected setting on the Logic Apps Http Trigger
I then set Schema Valdiation to on
Now when I try call my Logic Apps workflow the Json payload is validated against the schema and the caller gets an error back to this effect.
Flow can also be also configured in exactly the same way to validate a Json Schema.