1

According to Postbin (as suggested, I tested my webhook using Postbin), the content-type for the request is application/x-www-form-urlencoded.

Apparently, the correct type is application/json.

Can that be changed?

(I'm trying to receive the web hook at an ASP.NET MVC3 controller action. I think that action is expecting content of type application/json so is failing to deserialize the request)

flag
I'm now using a string parameter called payload and Json.NET to deserialize. Incidentally, I've had to decorate the controller action with [ValidateInput(false)] and change the validation mode (<httpRuntime requestValidationMode="2.0"/>) to avoid request validation problems. – Robin M May 10 2011 at 15:16

1 Answer

2

Actually, that's correct. We are in fact posting form-encoded data, with a single parameter, payload, which in turn is JSON. I think you're probably trying to parse the data incorrectly. Simply having an MVC 3 controller method that takes a single string parameter called payload, and then deserializing that, should work correctly.

link|flag
Ah, yes. I didn't read the documentation properly and I misread the Postbin output and didn't notice the payload. I still think it'd be better to post as application/json, so that things like MVC3 will deserialize automagically, although I can understand that most things understand application/x-www-form-urlencoded. Perhaps a different type of webhook or configuration for the existing one? – Robin M May 10 2011 at 12:06

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.