Why am I getting a validation error when trying to send a POST with payloads in JSON format?

This topic was automatically generated from Slack. You can find the original thread here.

I am trying to send a POST but I am getting a validation error.

Here is what I am using for the body.

{"type":"with_payloads",
"payloads":[{{steps.trigger.event.body}}]
}

Here is the return error

Payload validation failed: callback: Required
type: Invalid literal value, expected "with_inputs"
type: Invalid literal value, expected "with_work_item_ids"
work_item_ids: Required
type: Invalid literal value, expected "with_payloads"
payloads: Required

The Result says this is the Inputs Body.

{"type":"with_payloads",
"payloads":[[object Object]]
}

To test, I copied value from the trigger and pasted it (edited) and it works as a static value. This is a cleaned version. of the body.

{
    "type": "with_payloads",
"payloads": [
        {
            "eventData": {
                "clientEmailId": "********************@gmail.com",
                "document": {
                    "name": "Document.pdf",
                    "sasUrl": "https://storage.blob.core.windows.net/......"
                },
                "documentFieldName": "fdsadf",
                "documentRequestListId": "f649fe25-717c-491c-a327-18764aab698e",
                "uniqueArgs": "",
                "uploadedDate": "10/28/2023"
            },
            "eventType": 4000
        }
    ]
}

Can someone help me if there is an interim step I need to process value from the trigger into something that can be sent a a value in a broader json. I also tried Key-Value pairs and get the following error

Payload validation failed: callback: Required
type: Invalid literal value, expected "with_inputs"
type: Invalid literal value, expected "with_work_item_ids"
work_item_ids: Required
type: Invalid literal value, expected "with_payloads"
payloads: Required

Here is the screenshot for the Key Value.
Thanks

image.png

image.png

Try without the quotes in the POST configs:

image.png

The quotes should be added automatically as the data is converted to JSON.

Otherwise, maybe converting the body to JSON would work. :thinking_face:

[{{JSON.stringify(steps.trigger.event.body)}}]

I put the JSON.stringify in the Raw Request Body. That worked. Thanks.