Exposing API Webhook for Twilio

Exposing API Webhook for Twilio

  

Hi,

I am trying to expose an API for the Twilio webhook functionality.

On the Twilio debugger I get an error message: unsupported media type with a body response:

{
    "Errors": [
        "The request entity's media type 'application/x-www-form-urlencoded' is not supported for this resource."
    ],
    "StatusCode": 415
}


I believe the content-type needs to be application/json coming in from Twilio but I am not sure how to change that.


Any help would be much appreciated!

Justin Sirpilla wrote:

Hi,

I am trying to expose an API for the Twilio webhook functionality.

On the Twilio debugger I get an error message: unsupported media type with a body response:

{
    "Errors": [
        "The request entity's media type 'application/x-www-form-urlencoded' is not supported for this resource."
    ],
    "StatusCode": 415
}


I believe the content-type needs to be application/json coming in from Twilio but I am not sure how to change that.


Any help would be much appreciated!

Hello Justin, by default Twillio's REST API return XML, with a root element of <TwillioResponse>. Twillio also supports returning resource represantation as JSON. Simply add the .json extension to any resource URI.