Home > Software engineering >  add details to to HTTP response when eceiving HTTP requst
add details to to HTTP response when eceiving HTTP requst

Time:12-08

I have created a logic app to receive an http request and validate the content which is fine. But when I receive the 400 error message, it said only that it was expecting an integer but received a string for example. I would like to add the name of the field that generates the error is it possible?

postman response enter image description here

I added an http response to be executed when the requst fails but it's never triggered.

logic flow

enter image description here

CodePudding user response:

You can assign http response to a variable and then you can check which filed is causing error. I have reproduced issue from my side and below are steps I followed,

  1. Initially created logic app as shown below, enter image description here
  2. Payload of http trigger is, enter image description here Logic app trigger is enabled with schema validation, enter image description here
  3. I have tried to run trigger with below payload,
{
    "number":1600,
    "street_name":"pennsylvania",
    "street_type":7
}

Got error "Failed to start a run of logic app alertschlapp. The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Invalid type. Expected String but got Integer.'." enter image description here

  1. Next modified logic app as shown below, enter image description here
  2. Added three initialize variables action for number, street_name and street_type number: enter image description here street_name: enter image description here street_type: enter image description here
  3. Ran the logic app with below payload,
"number":1600,
    "street_name":"pennsylvania",
    "street_type":7
  1. Logic app failed with below error, enter image description here In this way, you can find out which field value is causing issue.
  • Related