415 Error when attempting to create webhook

Hi,
When attempting to create webhooks for two of my customers, I’m receiving a 415 error. Why is this?

Here’s a partial sample of the code that should explain what I’m trying to do

url = 'https://api-proxy.pipedrive.com/webhooks'
webhook_attrs = { subscription_url: "#{Rails.application.secrets.webhook_url}/stages",
                  event_action: '*',
                  event_object: 'stage',
                  http_auth_user: 'omitted',
                  http_auth_password: 'omitted' }
user_auth_headers = { 'Accept': 'application/json',
                      'Accept-Encoding': 'utf8',
                      'Authorization': "Bearer #{@access_token}" }
response = RestClient.post(url, webhook_attrs, user_auth_headers)

Error thrown is:


{"statusCode"=>415,
 "code"=>"FST_ERR_CTP_INVALID_MEDIA_TYPE",
 "error"=>"Unsupported Media Type",
 "message"=>"Internal Server Error (138d2d8e-d6bb-426b-bf3d-7e0540a7cf9a)"}

I tried using the access_token to get a deal and a person and it worked correctly, so it appears I’m authenticated.

Regards,
Kenton

Hi @Kenton ,

Could you also add Content Type header

Content-Type:application/json

to request headers and try again?

It’s fixed now. I didn’t add the header, but the request now works.

1 Like