Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Checking if the HTTP response body is empty

What I am trying to achieve is to check if the body that is returned from the HTTP POST method in Logic App (which is a trigger) is empty or not.

enter image description here

I have tried to look for the answer in docs, but could not really find the right answer. Tried this, but this does not work either "empty(triggerBody())".

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I have reproduced in my environment and below are my expected results:

Design:

To check if its empty or not use empty(triggerBody()) in compose action then use this output inside the condition action(is equal to true).

enter image description here

If true then its empty, if false its not empty.

Output:

enter image description here

Codeview:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Compose": {
                "inputs": "@empty(triggerBody())",
                "runAfter": {},
                "type": "Compose"
            },
            "Condition": {
                "actions": {},
                "expression": {
                    "and": [
                        {
                            "equals": [
                                "@outputs('Compose')",
                                true
                            ]
                        }
                    ]
                },
                "runAfter": {
                    "Compose": [
                        "Succeeded"
                    ]
                },
                "type": "If"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {}
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading