Document how to use HTTP Post Action

I've been having difficulty getting the HTTP POST action to work. It would be great to have a docs page on how to use it and ideally links to one or more Playbooks that use it successfully. Here are a few of the things I've found: 1. If you add "Content-Type: application/json" to the headers, it will fail with a "No valid JSON provided as POST request headers" error. It's unclear to me what this means, so the error message could perhaps be more intuitive. I removed the "Content-Type: application/json" from the Headers, and the exact same POST request body succeeded. Update: OK, after a bit of fiddling, it seems like Bardeen expects the Headers field to be JSON where the keys are header names and values the headers' associated values, e.g. { 'Content-Type': 'application/json' } 2. If you provide an invalid or unexpected HTTP header, Bardeen will give you an opaque error: "Failed to invoke 'http post request'. Oops, you found an opportunity for us to improve this app. We're investigating – please retry." A more specific (if I'm understanding this correctly) error would be something like: "It appears you've provided an HTTP header we don't understand (). Here are the valid HTTP headers you can use: ." The JSON key I provided has a space in it, which I don't believe is allowed in HTTP headers, so that could also be the issue.

Proposed by: Clint Gibler - Jun 17,22

Imported from canny

:up: Upvotes: 6

2 Likes

I just ran into a similar issue with “No valid JSON provided as POST request headers. Please make sure your input is properly formatted as valid JSON.”

Presumably having a problem because I didn’t supply any headers (figured content type was automatically computed, and the custom dev API didnt need an auth header)

Anyways, I was able to get a round it by supplying a dummy custom header:
{
“Custom-Header”: “CustomHeader”
}

Could someone share a proper way to setup the POST Request from URL, Body and headers?