Blog API Methods

Update a Blog Post

PUT  /blog/v1/posts/:post_guid.atom

For a given blog post, as identified by its GUID, you can update any subset of the fields you post new values for. Tags can also be updated this way, but any existing tags will be replaced with the new set of tags you assign. This means that whatever tags the post previously had that are not included in the new post will be explicitly removed from the post.

Fields like id, hs:portalId, hs:blogGuid, hs:postAnalytics are read-only, cannot be updated, and will be ignored. Only the fields you use to create a post can be updated (body, title, summary, categories, hs:metaDescription, hs:metaKeywords, etc.)

This request expects one element in the request body, an AtomPub-formatted XML snippet that is the updated post.

Your request Content-Type header must be application/atom+xml and your request method must be PUT.

Required Parameters How to use Description
Post GUID Used in the request URL Unique identifier for the particular blog post that you're updating.
HubSpot OAuth Access Token access_token=X - Used in the request URL The HubSpot API key for the portal that you're making the call for.
Optional Parameters How to use Description
Author Name <name> - Used in the request body The name of the author for the blog post you're creating
Author Email <email> - Used in the request body The blog post author's email address. This email address MUST be a valid, current user in the HubSpot portal the blog resides in.
Content <content> - Used in the request body The blog post's content. This can be pain text or HTML. See sample request body below for an example.
Summary <summary> - Used in the request body The summary of the post you're creating
Tags <category term="tag 1" /> - Used in the request body Tags help to organize blog posts, you can create new tags or use existing tags when creating a new blog post.
Meta Description <hs:metaDescription> - Used in the request body The <meta> description of the blog post's page that you're creating in HubSpot.
Meta Keywords <hs:metaKeywords> - Used in the request body The <meta> keywords for a blog post that you're creating in HubSpot. You can include multiple keywords, separated by commas.

Example URL:  https://api.hubapi.com/blog/v1/posts/d36d6b7b-1e56-424b-a78c-bfe442a33447.atom?access_token=demooooo-oooo-oooo-oooo-oooooooooooo

Example AtomPub request body for this API call:

        <?xml version="1.0" encoding="utf-8"?>
        <entry xmlns="http://www.w3.org/2005/Atom" xmlns:hs="http://www.hubspot.com/">
            <title>new improves Updated title</title>
            <summary>updated summary</summary>
            <content type="text">updated content</content>
            <category term="hapihp updated tag 1" /><category term="hapihp updated tag 2" />
            <hs:metaDescription>updated meta desc</hs:metaDescription>
            <hs:metaKeywords>i am,a keyword,wow,really?</hs:metaKeywords>
        </entry>
    

The response from this API call are standard REST-style HTTP header response codes that mark success or failure.

  • 200 OK - For a successful call, meaning the post has been updated. The response body will be the created object with the id fields populated, as seen below.
  • >= 400 Error for any sort of error.

Example response header for this API call:

    HTTP/1.1 200 OK
    Date: Tue, 06 Dec 2011 23:20:18 GMT
    Server: Apache-Coyote/1.1
    Content-Type: application/atom+xml;charset=UTF-8
    Connection: close
    Transfer-Encoding: chunked
    

Example response body for this API call:

        <?xml version="1.0" encoding="UTF-8"?>
        <feed xmlns="http://www.w3.org/2005/Atom">
            <id>0d61e4ca-e395-4c1c-8766-afaa48bf68db</id>
            <title type="text">Test Blog (content from customers.hubspot.com)</title>
            <entry xmlns:hs="http://www.hubspot.com/">
                <id>ae15391a-7bd9-454d-b51b-5c480a010497</id>
                <title type="text">new improves Updated title</title>
                <summary type="text">updated summary</summary>
                <content type="html">updated content</content>
                <author>
                    <name>testapi@hubspot.com</name>
                    <email>testapi@hubspot.com</email>
                </author>
                <link href="http://demo.hubapi.com/blog-for-testing/bid/80149/" />
                <updated>2011-11-29T23:45:42.000Z</updated>
                <published>2011-11-29T21:28:06.000Z</published>
                <hs:portalId>62515</hs:portalId>
                <hs:blogGuid>0d61e4ca-e395-4c1c-8766-afaa48bf68db</hs:blogGuid>
                <hs:metaDescription />
                <hs:metaKeywords />
                <hs:draft>false</hs:draft>
                <hs:sendNotifications>false</hs:sendNotifications>
                <category term="hapihp updated tag 2" />
                <category term="hapihp updated tag 1" />
                <hs:postAnalytics>
                    <hs:views>0</hs:views>
                    <hs:comments>2</hs:comments>
                    <hs:inboundLinks>0</hs:inboundLinks>
                </hs:postAnalytics>
            </entry>
        </feed>