Using COS API to update an email template


#1

I am using the COS API “Update the Template” (PUT /content/api/v2/templates/:template_id) to add additional content to a template, but the operation fails with “The remote server returned an error: (405) Method Not Allowed.”

The endpoint being used is http://api.hubapi.com/content/api/v2/templates/1...5?hapikey=… (where the template Id and API key are correct values). The request body is JSON data with just the id, label and source values.

Should this operation work? If so, why is it failing?


#2

Hi @AJD

Sounds like you’re using the endpoint here?

That endpoint should work with a PUT request, and I’m not seeing any issues testing that on my side.

Can you share any other details for the request? Even if there was a problem with the data, I wouldn’t expect a 405 response from that endpoint unless you were making some type of request other than PUT, GET, or DELETE.


#3

I was using a method I had originally developed for the Forms API to POST data to Hubspot to send the updated template to the COS API endpoint. I have now created a new HTTP PUT method - using the same endpoint and JSON data now correctly updates the template.