Skip to main content

Update Blog Post

Update an existing blog post.

HTTP Request

PATCH/api/blog/posts/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Admin or Staff with required PostPermission
  • Permission Code: 3223
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the blog post to update

Request Body

FieldTypeRequiredDescription
titleStringYesTitle of the blog post.
slugStringYesSlug for the blog post (unique).
is_publishedBooleanNoWhether the post has published status (default=False)
excerptStringYesShort summary or excerpt of the blog post.
authorIntegerNoID of the author of the blog post (nullable)
featured_imageIntegerNoID of the featured image for the blog post(nullable)
categoriesIntegerNoList of ids of the blog post
bodyStringYesFull content of the blog post.

Example Requests

1import requests
2response = requests.patch('http://www.example.com/api/blog/posts/1', json={
3  'title': 'Updated Blog Post Title',
4  'slug': 'some-edited-slug',
5  'is_published': true,
6  'excerpt': 'This is an updated excerpt for the blog post.',
7  'author': 3,
8  'featured_image': 2,
9  'categories': [1,2],
10  'body': 'This is the updated full content of the blog post.'
11}, headers={
12  'Authorization': 'Token <your_api_key>'
13})
14
15print(response.json())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the blog post(unique)
titleStringTitle of the blog post
slugStringSlug for the blog post(unique)
viewsIntegerNumber of views the blog post has received(default=0)
human_readable_viewsStringHuman-readable format of the views (e.g., 1.2K)
is_publishedBooleanWhether the post is published(true) or draft(false)
excerptStringShort summary or excerpt of the blog post
truncated_excerptStringTruncated version of the excerpt (e.g., first 100 characters)
author_dataObjectAuthor details including `id`, `username`, and `full_name`
featured_image_dataObjectFeatured image data including `id`, `type`, `name`, `size`, `human_readable_size`, `f`, `width`, `height`, and `mode`
categories_dataobjectPost categories data
created_atString (ISO 8601)Timestamp when the blog post was created
updated_atString (ISO 8601)Timestamp when the blog post was last updated
truncated_bodyStringTruncated version of the post body
bodyStringBody of the post
metaobject

Author Data Structure

FieldTypeDescription
idIntegerUnique ID of the author (unique)
usernameStringUsername of the author (unique)
full_nameStringFull name of the author (nullable)

Featured Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the featured image (unique)
typeStringFile type (e.g., image/jpeg) (nullable)
nameStringOriginal file name (nullable)
sizeIntegerFile size in bytes (nullable)
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB) (nullable)
fStringURL to access the image file
widthIntegerImage width in pixels (nullable)
heightIntegerImage height in pixels (nullable)
modeStringColor mode (e.g., RGB, CMYK) (nullable)
thumbnailsList of thumbnail objectsthumbnails of the image

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

Post Category Data Structure

FieldTypeDescription
idIntegerPost category id (unique)
nameStringPost category name

Meta Data Structure

FieldTypeDescription
idIntegerId of the meta data
keyStringThe key name of the meta data
value_textStringThe text value of the meta data
value_fileFileThe file value of the meta data
    • Meta data is only editable via the core page endpoints