Site owners create blog posts for their blogs. Weebly blog posts can accept comments from readers. When comments are allowed, they can be anonymous and they can optionally require approval. The approval process is handled by the moderation app (such as Disqus) set on the blog.

​Use the Blog Post API to return details about a post to a blog, or to update a post. A message can be configured to be used when blog posts are shared on social media. Tags are used to group blog posts together.

Fields

The following table shows all fields that exist for this API, those that are returned when you retrieve a list, those that are required for PUT and those that are changeable using PATCH and PUT. All fields are returned when you retrieve a single item.

Name Description Type List Required Changeable
user_id The unique ID of the authenticated user string X
site_id ID of a Weebly site, unique to the currently authenticated user​ string X X
post_id Unique ID for this blog post. string X
post_title Title of the blog post. string X X
post_body Content of the post, including the markup. string X X X
post_author The unique user_id of the user who created the post. string X
post_created_date ​Date the post draft was first created. string X
post_lastrevision_date ​Date the post was last updated. string
allow_comments Whether or not comments are allowed for this post, and if allowed, if non-anonymous comments are allowed.
Valid values are:
  • yes: Comments are allowed.
  • no: Comments are allowed.
  • noanon: Comments are allowed, but they can't be anonymous.
string X
post_link URL for this post, for example, mynewblogpost.html string
require_approval Whether or not comments require approval on this post.
​Valid values are:
  • true
  • false
boolean
post_url ​The full URL, including protocol, to the post. For example: http://mysite.weebly.com/blog/mynewblogpost.html string
share_message ​​Deprecated as of 10/18/18
The configured message to be used when sharing the post.
string
seo_title ​​​The SEO title for the post. Site owners can create a different title for the browser title bar. string
seo_description ​​​The SEO page description for the post. string
tags ​​​​An array of strings that represent tags for the post. These are shown as Categories in the UI. array of strings X
commenting_system The system used to allow commenting on the blog. The value default means that the native Weebly system is used.
Valid values are:
  • ​default
  • disqus
  • facebook
string
date_format Format used for dates on this site.
Valid values are:
  • n/j/Y: month/day/year
  • j/n/Y: day/month/year
string
created_date Date the post was first created. Unix GMT Timestamp X
updated_date Date the post was last updated. Unix GMT Timestamp

GET
Retrieve a List of Blog Posts

GET /v1/user/sites/{SITE_ID}/blogs/{BLOG_ID}/posts

Returns all posts for the given blog. Only list fields are returned.


scope: read:blog

Example CURL request returning all blog posts:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/blogs/6543/posts \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "user_id": "123456",
        "site_id": "987654321",
        "post_id": "528036988357777409",
        "post_title": "My New Blog Post",
        "post_created_date": "2017-10-03 11:58:06",
        "created_date": 1402964756
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "post_id": "648291276105250798",
        "post_title": "Another Blog Post",
        "post_created_date": "2013-09-06 09:57:04",
        "created_date": 1378504674
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "post_id": "489389593268427583",
        "post_title": "Travel Blog Post",
        "post_created_date": "2013-09-06 07:00:00",
        "created_date": 1378504578
    }
]

GET
Retrieve Details for a Blog Post

GET /v1/user/sites/{SITE_ID}/blogs/{BLOG_ID}/posts/{POST_ID}

Returns all fields for the given blog post.


scope: read:blog

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/blogs/6543/posts/827004614453058652 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the blog post are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "post_id": "827004614453058652",
    "post_title": "Feeling the Burn",
    "post_body": "Stayed in the sun too long<\/div>",
    "post_author": "123456",
    "allow_comments": "yes",
    "post_link": "my-new-blog-post.html",
    "require_approval": false,
    "post_url": "http:\/\/mysite.weebly.com\/blog\/my-new-blog-post.html",
    "share_message": "Read my latest blog post!",
    "seo_title": null,
    "seo_description": null,
    "tags":  {
        "health": "health",
        "food": "food"
    },
    "commenting_system": "default",
    "created_date": 1402964756,
    "updated_date": 1402964756,
    "date_format": "j/n/y"
}

PUT
Replace a Blog Post

PUT /v1/user/sites/{SITE_ID}/blogs/{BLOG_ID}/posts/{POST_ID}

Replaces the given blog post.


scope: write:blog

These fields can be replaced:

Name Description Type Notes
post_body ​​The content of the post, including the markup. string Required
post_title The title of the post. string
post_tags ​An array of categories assigned to this post. string
allow_comments Whether or not comments are allowed for this post.
Valid values are:
  • yes
  • no
string When you update from no to yes, then the value of commenting_system updates to default (which is Weebly).

Example CURL request:

curl --request PUT \
--url https://api.weebly.com/v1/user/sites/987654321/blogs/6543/posts/827004614453058652 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"
--data '{
            "post_body": "Stayed in the sun too long, and now I am totally burned!"
}'

Example response:

{
    "user_id": "123456",
    "site_id": "987654321",
    "post_id": "827004614453058652",
    "post_title": "Feeling the Burn",
    "post_body": "Stayed in the sun too long, and now I am totally burned!<\/div>",
    "post_author": "72773000",
    "allow_comments": "yes",
    "post_link": "feeling-the-burn.html",
    "require_approval": false,
    "post_url": "http:\/\/example.com\/blog\/feeling-the-burn",
    "share_message": null,
    "seo_title": null,
    "seo_description": null,
    "tags": [],
    "commenting_system": "default",
    "created_date": 1468437625,
    "updated_date": 1468437625,
    "date_format": "j/n/y"
}

PATCH
Update a Blog Post

PATCH /v1/user/sites/{SITE_ID}/blogs/{BLOG_ID}/posts/{POST_ID}

Updates the given blog post.


scope: write:blog

These fields can be updated:

Name Description Type Notes
post_body ​​The content of the post, including the markup. string
post_title The title of the post. string
post_tags ​An array of categories assigned to this post. string
allow_comments Whether or not comments are allowed for this post.
Valid values are:
  • yes
  • no
string When you update from no to yes, then the value of commenting_system updates to default (which is Weebly).
curl --request PATCH \
--url https://api.weebly.com/v1/user/sites/987654321/blogs/6543/posts/827004614453058652 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"
--data '{
            "post_body": "Stayed in the sun too long, and now I am totally burned!"
}'

Example response:

{
    "user_id": "123456",
    "site_id": "987654321",
    "post_id": "827004614453058652”,
    "post_title": "Feeling the Burn",
    "post_body": "Stayed in the sun too long, and now I am totally burned!<\/div>",
    "post_author": "72773000",
    "allow_comments": "yes",
    "post_link": "feeling-the-burn.html",
    "require_approval": false,
    "post_url": "http:\/\/example.com\/blog\/feeling-the-burn",
    "share_message": null,
    "seo_title": null,
    "seo_description": null,
    "tags": [],
    "commenting_system": "default",
    "created_date": 1468437625,
    "updated_date": 1468437625,
    "date_format": "j/n/y"
}

DELETE
Delete a Blog Post

DELETE /v1/user/sites/{SITE_ID}/blogs/{BLOG_ID}/posts/{POST_ID}

Deletes the given blog post.


scope: write:blog

Example CURL request:

curl --request DELETE \
--url https://api.weebly.com/v1/user/sites/987654321/blogs/6543/posts/827004614453058652 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Response There is no response to a delete request.


Help make these docs better!









Tags: