cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JeffGimo
Resolver I
Resolver I

Check for Missing Field When a HTTP Request is Received

Hope everyone is doing good.

 

I have a trigger:

JeffGimo_0-1631044690796.png

The request body json schema is:

 

{
    "items": {
        "additionalProperties": false,
        "properties": {
            "key": {
                "type": "string"
            },
            "value": {
                "type": "string"
            }
        },
        "required": [
            "key",
            "value"
        ],
        "type": "object"
    },
    "type": "array",    
        "required": [
            "key",
            "value"
        ]
}

 

I am trying to output an error if a Field is missing.

 

Sample: When my request is like this below where there is no "value".

 

[
  { "key": "Request_ID" }
]

 

I need to output an error like "Missing Field: value".

 

Is this possible??

 

Here's a sample run where there is missing field.

It is still successful even though there is a missing field which is value.

JeffGimo_0-1631045070166.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
JeffGimo
Resolver I
Resolver I

Found the solution under settings.>Schema Validation.

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @JeffGimo,

 

I don't know if this is exactly what you are looking for but you could configure a run after for the has failed status on one of the next actions and output the actually error code.

 

Below is an example of that.

 

1. Retrieve the value field. And add another compose action after that with configure run after condition for has failed.

 

configurerunafterhasfailed.png

 

2. Use the following expression in that compose action

 

actions('Compose')?['Error']['code']

 

runafterfailed_errorcode.png

JeffGimo
Resolver I
Resolver I

Found the solution under settings.>Schema Validation.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,115)