In a Cloud Flow, if you are using an HTTP Request Trigger that accepts HTTP Requests – you have the option to validate the Incoming data based on the Schema of the JSON.
Scenario
Let’s assume this is the data which will be passed to the HTTP Request Flow –
HTTP Request & Schema
Let’s look at the HTTP Request Trigger itself in a Cloud Flow –
- First, let’s initiate the HTTP Request Trigger here and make sure we generate the Schema from the same data we will be passing. I also have a separate post on the HTTP Request itself which you can check here – Accept HTTP Requests in a Flow and send Response back | Power Automate
- Here, we can paste the sample data which we saw in the scenario above.
- Once you click Done, the Schema will be generated from the sample data you’ve just entered. Additionally, if needed you can also specify the method you are looking to implement. POST in this case
- Further on, I’m doing some operations internally and finally, I’ll be sending a response to the caller using the HTTP Response Action in HTTP connector in a Cloud Flow
- And here is what I’m sending back in Response if my Flow happens to work as expected.
- So, the end of my Flow looks something like this. (Depending on what you are trying to do in your Flow)
Turning Validation On
Now, coming back to the HTTP Request trigger itself –
- Go to Settings on the HTTP Trigger itself –
- Now, look for Schema Validation option and turn it on.
Now, let’s consider the scenario and test the Postman.
Testing with Postman – Validation On
Let’s try to send incorrect data to the Flow using Postman which doesn’t comply with the Schema and see how we receive the 400 Error message in Postman
- Now, when I try to send the correct data as expected by the Schema once the validation is turned on, I’ll get a success message once the Flow has finished running and return with a 200 code
- Now, if we try to send incorrect data, it will not be accepted. So first, I’ll add a new attribute which I’ve not added in the schema already in order for the validation to fail and give us an expected validation error.
See the data which I’m sending. To which, I get the 400 Bad Request error - If you get back a 400 Bad Request, the Flow will not register it as a Flow Run. Hence, you won’t know if the Flow was hit or not.
- And in case the validation is turned OFF, you’ll get the Response as expected from the Flow in the event that Flow has completed successful execution.
Hope this post helped!
Here are some more Power Automate / Flow posts you might want to check –
- Tag a User in a Microsoft Teams post made using Power Automate
- Converting JSON to XML and XML to JSON in a Flow | Power Automate
- Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
- FormatDateTime function in a Flow | Power Automate
- Formatting Approvals’ Details in Cloud Flows | Power Automate
- Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
- Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
- InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
- Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
- Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
- Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
- Secure Input/Output in Power Automate Run History
Here are som
How do I use the trigger link in an email? and instead of displaying a blank page, display a message or a video?
Please help URGENTLY.
LikeLike
Make sure you turn on HTML mode in the Send Email V2 steep. Denoted by in the step.
Hopefully, you are using Outlook v2 connector.
LikeLike