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
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the blog post to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| title | String | Yes | Title of the blog post. |
| slug | String | Yes | Slug for the blog post (unique). |
| is_published | Boolean | No | Whether the post has published status (default=False) |
| excerpt | String | Yes | Short summary or excerpt of the blog post. |
| author | Integer | No | ID of the author of the blog post (nullable) |
| featured_image | Integer | No | ID of the featured image for the blog post(nullable) |
| categories | Integer | No | List of ids of the blog post |
| body | String | Yes | Full content of the blog post. |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1curl -X PATCH "http://www.example.com/api/blog/posts/1" -H "Authorization: Token <your_api_key>" -d '{
2 'title': 'Updated Blog Post Title',
3 'slug': 'some-edited-slug',
4 'is_published': true,
5 'excerpt': 'This is an updated excerpt for the blog post.',
6 'author': 3,
7 'featured_image': 2,
8 'categories': [1,2],
9 'body': 'This is the updated full content of the blog post.'
10}'Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the blog post(unique) |
| title | String | Title of the blog post |
| slug | String | Slug for the blog post(unique) |
| views | Integer | Number of views the blog post has received(default=0) |
| human_readable_views | String | Human-readable format of the views (e.g., 1.2K) |
| is_published | Boolean | Whether the post is published(true) or draft(false) |
| excerpt | String | Short summary or excerpt of the blog post |
| truncated_excerpt | String | Truncated version of the excerpt (e.g., first 100 characters) |
| author_data | Object | Author details including `id`, `username`, and `full_name` |
| featured_image_data | Object | Featured image data including `id`, `type`, `name`, `size`, `human_readable_size`, `f`, `width`, `height`, and `mode` |
| categories_data | object | Post categories data |
| created_at | String (ISO 8601) | Timestamp when the blog post was created |
| updated_at | String (ISO 8601) | Timestamp when the blog post was last updated |
| truncated_body | String | Truncated version of the post body |
| body | String | Body of the post |
| meta | object |
Author Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the author (unique) |
| username | String | Username of the author (unique) |
| full_name | String | Full name of the author (nullable) |
Featured Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the featured image (unique) |
| type | String | File type (e.g., image/jpeg) (nullable) |
| name | String | Original file name (nullable) |
| size | Integer | File size in bytes (nullable) |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) (nullable) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels (nullable) |
| height | Integer | Image height in pixels (nullable) |
| mode | String | Color mode (e.g., RGB, CMYK) (nullable) |
| thumbnails | List of thumbnail objects | thumbnails of the image |
Thumbnail Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the thumbnail (unique) |
| f | String | URL to access the thumbnail file |
| size | Integer | File size in bytes (nullable) |
Post Category Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Post category id (unique) |
| name | String | Post category name |
Meta Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Id of the meta data |
| key | String | The key name of the meta data |
| value_text | String | The text value of the meta data |
| value_file | File | The file value of the meta data |
- Meta data is only editable via the core page endpoints