I have a logic app that runs as follows:
What I would like to do now is add an extra step between Step 2 and Step 3 . After making the HTTP POST call, I would like to verify the content inside the JSON file that gets returned. If there is an error present in the JSON file, I want the Logic App to stop there.
Is there a particular step that I can use in Azure's Logic App to verify the data and have that step decide if it should continue on or not.
For this requirement, you can refer to my logic app below:
1. I initialize a variable named " resultFromHTTP " to simulate the json from your HTTP request(step 2). And I delete some character, so the " resultFromHTTP " is not a valid json format.
2. Then I initialize another variable and use the expression json(variables('resultFromHTTP'))
in its value.
3. Run the logic app, it will fail and show error message like below screenshot. If the json is in valid format, it will run success.
=============================== Update ==============================
For your latest question, if the result json from HTTP request is not in valid json format and not a very long string, you can do it like this:
The contains(...
expression is contains(variables('resultFromHTTP'), 'Data Not Found')
. Then you can do what you want under "if true" or "if false".
If the result json from HTTP request is in valid json format, you can use " Parse JSON " action to parse it and get the specified field and then judge if it equals to "Data Not Found".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.