httpPostJson -- Not able to trigger WebAPI call

My server side code accepts and produces Json.
I am unable to receive a response. We are using httpPostJson()… We understand that there is no need to set content type or request contentType as per “” … we also tried by setting content type , but it ignores the “type” we are specifying and gets set to “text/html” … because of that we are unable to post.

The following should work:

def params = [
        uri: "https://domain.tld",
        path: "/my/path",
        headers: [
                "Host": host,
                "Content-Type": "application/json",
                "Authorization": "OptionalAuthHeaderExample"
        body: [
httpPostJson(params) {
    log.debug "Event data successfully posted"

Edit: When you say that you are unable to receive a response, do you mean on your server that you are POST’ing data to or something else?

Thank you @joshua_lyon for your response. Your code example was very helpful to validate our approach. We were able to resolve the issue by updating our server settings. After all we found out the smartthings app code was not the issue.

1 Like