Blog API Methods

Publish a Blog Post

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

For a given blog post, as identified by its GUID, you can update it and set it as published. When publishing posts you must pay close attention to the three required parameters below:

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

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

Please note that there will be slight delay from the time that you make this API call to publish a post, to the time that the comment shows up in the HubSpot user interface.

Required Parameters How to use Description
Post GUID Used in the request URL Unique identifier for the particular blog post that you're publishing.
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.
Is Draft <hs:draft> - Used in the request body In order to publish a post, set this to false. Otherwise, this will simply be viewed as a normal update to the blog post, and no publishing-related fields will be updated.
Send Notifications <hs:sendNotifictions> - Used in the request body If false then email and social media notifications will be not be sent. If not specified or explicitly set to true, then the email and social media notifications will go out as normal.
Published Time <published> - Used in the request body This is an ISO-8601 formatted date string in UTC time. If this is not specified it will be 30 minutes in the future from when you API call is made, if you enable sending notifications and the publish time is less than 30 minutes in the future, you will receive a 400 error.
Optional Parameters How to use Description
None None No optional parameters for this method.

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/">
            <published>2011-12-06T19:38:24Z</published>
            <hs:draft>false</hs:draft>
            <hs:sendNotifications>false</hs:sendNotifications>
        </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 publishd. 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:38:26 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>