Skip to main content

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

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the post category to update

Request Body

FieldTypeRequiredDescription
imageIntegerNoRelated image of the post category
orderIntegerNoRow order of the post category
parentIntegerNoThe parent category id of the post category
nameStringNoName of the post category
slugStringNoThe slug of the post category(unique)
descriptionStringNoThe description of the post category

Example Requests

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())

Response Fields

FieldTypeDescription
idIntegerId of the post category(unique)
image_dataObjectRelated image of the post category(nullable)
orderIntegerRow order of the category(nullable)
parentIntegerParent id of the category(nullable)
nameStringname of the category
slugStringslug of the category (unique, nullable)
descriptionStringdescription of the post category(nullable)
posts_countIntegerthe number of blog posts under this category
children_countIntegerthe number of child categories
created_atdatetimethe creation time of the post category
updated_atdatetimelast updated time of the post category

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)
{
"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"
}