For a given blog, as identified by its GUID, create a new draft blog post.
When creating a new post the author for your post must be a registered and active HubSpot user's email address, otherwise you'll receive a 400 Bad Request error from the API. We support tags using category tags in atom. For the moment we only use the "term" attribute, not the "label" attribute.
This request expects one element in the request body, an AtomPub-formatted XML snippet that is the new post. Your request Content-Type header must be application/atom+xml and your request method must be POST.
Please note that there will be slight delay from the time that you make this API call to create a comment, to the time that the comment shows up in the HubSpot user interface.
| Required Parameters | How to use | Description |
|---|---|---|
| Blog GUID | Used in the request URL | Unique identifier for the particular blog that you're creating a post in |
| 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. |
| 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. |
| Optional Parameters | How to use | Description |
|---|---|---|
| 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/0d61e4ca-e395-4c1c-8766-afaa48bf68db/posts.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">
<title>find this one</title>
<author>
<name>Test Author</name>
<email>testapi@hubspot.com</email>
</author>
<summary>testing hapihp summary</summary>
<content type="html"><![CDATA[this is the content for testing hapihp]]></content>
<category term="hapihp tag 1" /><category term="hapihp tag 2" />
</entry>
The response from this API call are standard REST-style HTTP response codes that mark success or failure, with meta information about the call that was made.
Note that the author email address must match an active, valid user of the HubSpot portal to which this blog belongs. Otherwise you will get a 400 Bad Request error response.
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>d36d6b7b-1e56-424b-a78c-bfe442a33447</id>
<title type="text">find this one</title>
<summary type="text">testing hapihp summary</summary>
<content type="html">this is the content for testing hapihp</content>
<author>
<name>testapi@hubspot.com</name>
<email>testapi@hubspot.com</email>
</author>
<link href="http://demo.hubapi.com/blog-for-testing/bid/80781/" />
<updated>2011-12-06T22:55:43.000Z</updated>
<published>2011-12-06T22:55:43.000Z</published>
<hs:portalId>62515</hs:portalId>
<hs:blogGuid>0d61e4ca-e395-4c1c-8766-afaa48bf68db</hs:blogGuid>
<hs:metaDescription /><hs:metaKeywords />
<hs:draft>true</hs:draft>
<hs:sendNotifications>true</hs:sendNotifications>
<category term="hapihp tag 2" />
<category term="hapihp tag 1" />
<hs:postAnalytics />
</entry>
</feed>
HTTP Methods:
POST
Response Format:
Atom
Requires Authentication?
Yes
Rate Limited?
Headers