Webhooks - Bad Content-Type

Hi

Just taking an initial look at using webhook.I have the following code (I have hardcoded the form details for this initial test) :

{
    "event": "motionevent",
    "url": "https://mq-aws-eu-west-1.iron.io/1/projects/xxxxc7ac6c30xxxxxxxxxxxe/queues/recordings/messages",
    "requestType": "POST",
    "headers": { "Authorization": "OAuth VuxxxxxxxxxxxxnPErxxx"},
    "form": {
        "coreid": "xxxxxx000a473433373xxxxxxx",
        "movement" : "true",
        "temp" : "28.9"
    },
    "mydevices": true
}

On the CLI i am seeing:

{"name":"hook-response/motionevent/0","data":"\"{\\\"msg\\\":\\\"Bad Content-Type.\\\"}\"","ttl":"60","published_at":"2015-07-15T19:26:08.239Z","coreid":"undefined"}

Any idea why I am getting bad content type?

Also, anyone else used a webhook to iron.io worker? Does this look like the correct way to auth?

Thank you

Hmm..i wonder if this is incorrect or requires more that just Authorization?

Ah, OK. So this message is the response from the API endpoint provider and not from the Particle Cloud?

Hi @Kevin,

Yup! hook-response is the webhook sending you back the error from the target site. Your parameters are on the “form” property, which sets the Content-Type of your request to something like “application/x-www-form-urlencoded”. If the destination site needs an application/json request, try using the “json” property instead. :slight_smile:

Thanks!
David

yep - that was the issue. thank you.

1 Like