Update Blog Post Category
Update an existing post category
HTTP Request
PATCH/api/blog/categories/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff with required PostCategoryPermission or Admin
- Permission Code: 3203
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the post category to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| image | Integer | No | Related image of the post category |
| order | Integer | No | Row order of the post category |
| parent | Integer | No | The parent category id of the post category |
| name | String | No | Name of the post category |
| slug | String | No | The slug of the post category(unique) |
| description | String | No | The description of the post category |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.post('http://www.example.com/api/blog/categories/3', json={
3 "image": 6,
4 "order": 2,
5 "parent": 1,
6 "name": "cpus",
7 "slug": "cpu-pc",
8 "description": "central processing unit and extras"
9},headers={'Authorization': 'Token <your_api_key>'})
10print(response.json())1curl -X POST "http://www.example.com/api/blog/categories" -H "Content-Type: application/json"
2-H "Authorization: Token <your_api_key>"
3-d '{
4 "image": 6,
5 "order": 2,
6 "parent": 1,
7 "name": "cpus",
8 "slug": "cpu-pc",
9 "description": "central processing unit and extras"
10}Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Id of the post category(unique) |
| image_data | Object | Related image of the post category(nullable) |
| order | Integer | Row order of the category(nullable) |
| parent | Integer | Parent id of the category(nullable) |
| name | String | name of the category |
| slug | String | slug of the category (unique, nullable) |
| description | String | description of the post category(nullable) |
| posts_count | Integer | the number of blog posts under this category |
| children_count | Integer | the number of child categories |
| created_at | datetime | the creation time of the post category |
| updated_at | datetime | last updated time of the post category |
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) |
{
"id": 3,
"image_data": {
"id": 6,
"type": "image",
"name": "technology",
"size": 5123,
"human_readable_size": "5.00 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/02/technology.png",
"width": 225,
"height": 225,
"mode": "P"
},
"order": 2,
"parent": 1,
"name": "cpus",
"slug": "cpu-pc",
"description": "central processing unit and extras",
"posts_count": 0,
"children_count": 0,
"created_at": "2025-12-02T14:33:37.856753Z",
"updated_at": "2025-12-02T15:14:13.243486Z"
}