List All Blog Posts
Retrieve a list of blog posts with optional filtering, searching, and pagination.
HTTP Request
GET/api/blog/posts
Authorization
Authorization
- Required: Yes
- Permission: Admin or Staff with required Post Permission
- Permission Code: 3222
- Authentication: Token-based (Authorization: Token <your_api_key>)
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page. |
| offset | integer | 0 | Number of results to skip before returning results. |
| search | string | — | Search term to lookup results by `id`, `slug`, `title`, `category__name`, `body`, `author__id`, `author__username`, `author__email`, `author__first_name`, `author__last_name`. |
| ordering | string | — | Order results by (`id`, `title`, `categories`, `views`, `created_at`, `updated_at`, `author__id`, `author__username`, `author__first_name`, `author__last_name`). |
| id_min | integer | — | Minimum ID to filter results by. |
| id_max | integer | — | Maximum ID to filter results by. |
| created_date | string | — | Filter results by creation date (e.g., `2023-01-01`). |
| updated_date | string | — | Filter results by last updated date (e.g., `2023-01-01`). |
| created_from | string | — | Posts created after a specific date |
| created_to | string | — | Posts created before a specific date |
| updated_from | string | — | Posts last updated after a specific date |
| updated_to | string | — | Posts last updated before a specific date |
| views_min | integer | — | Minimum number of views to filter results by. |
| views_max | integer | — | Maximum number of views to filter results by. |
| has_image | boolean | — | Filter posts with/without a featured image |
| category_id | Integer | _ | Filter posts that are in a defined category |
| category_in | List | _ | Filter posts that are in a `comma-separated` list of category ids(eg 2,3,5) |
| category_tree_id | Integer | _ | Filter posts that are in a category or its sub-categories |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.get('http://www.example.com/api/blog/posts', params={
3 'limit': 5,
4 'ordering': 'created_at',
5 'search': 'Python',
6 'views_min': 100,
7 'views_max': 1000,
8 'has_image': True,
9 'created_from': '2023-01-01',
10 'created_to': '2023-12-31'
11},headers={'Authorization': 'Token <your_api_key>'})
12print(response.json())1curl "http://www.example.com/api/blog/posts?limit=5&ordering=created_at&search=Python&views_min=100&views_max=1000&has_image=true&created_from=2023-01-01&created_to=2023-12-31" -H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of BlogPost objects |
BlogPost Object Structure
| 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 |
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 |
Response Example
{
"count": 3,
"next": "http://127.0.0.1:8000/api/blog/posts?limit=2&offset=2",
"previous": null,
"results": [
{
"id": 42,
"title": "قیمت رم با افزایشی چشمگیر مواجه شد",
"slug": "pc-ram-prices-have-soared-by-up-to-25",
"views": 0,
"human_readable_views": "0",
"is_published": false,
"excerpt": "<p>با توجه به پیشرفت بسیار سریع تکنولوژی، داشتن رم اضافی برای اجرای بهتر برنامه‌ها و بازی‌های مختلف، ایده‌ای عالی برای دارندگان رایانه‌های شخصی به حساب می‌آید. با این حال، در هفته‌های اخیر به دلیل کمبود قطعات اولیه، قیمت رم افزایشی شدید داشته و رفع این نیاز را به چالشی بزرگ تبدیل کرده است.</p>",
"truncated_excerpt": "<p>با توجه به پیشرفت بسیار سریع تکنولوژی، داشتن رم اضافی برای اجرای بهتر برنامه‌ها و بازی‌های مختلف، ایده‌ای عالی برای دارندگان رایانه‌های شخصی به حساب می‌آید. با این حال، در…",
"author_data": {
"id": 2,
"username": "staffer",
"full_name": "عماد رخشانی"
},
"featured_image_data": {
"id": 4,
"type": "image",
"name": "rams",
"size": 118805,
"human_readable_size": "116.02 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/29/RAMFeatured.jpg",
"width": 1280,
"height": 720,
"mode": "RGB",,
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"categories_data": [],
"created_at": "2025-12-01T09:41:10.097414Z",
"updated_at": "2025-12-01T09:56:05.350542Z"
},
{
"id": 41,
"title": "کیبورد جدید سامسونگ با دکمه مخصوص DeX و هوش مصنوعی معرفی شد",
"slug": "samsung-smart-keyboard-ai-dex-launch",
"views": 0,
"human_readable_views": "0",
"is_published": false,
"excerpt": "<p>مهم‌ترین ویژگی‌های این کیبورد، دکمه‌های میان‌بر آن است: یک دکمه اختصاصی برای جابه‌جایی سریع بین سه دستگاه متصل‌شده به کیبورد وجود دارد. همچنین یک دکمه جدید برای دسترسی به هوش مصنوعی در نظر گرفته شده است.</p>",
"truncated_excerpt": "<p>مهم‌ترین ویژگی‌های این کیبورد، دکمه‌های میان‌بر آن است: یک دکمه اختصاصی برای جابه‌جایی سریع بین سه دستگاه متصل‌شده به کیبورد وجود دارد. همچنین یک دکمه جدید برای دسترس…",
"author_data": {
"id": 1,
"username": "BehroozGhorbani",
"full_name": "بهروز قربانی"
},
"featured_image_data": {
"id": 5,
"type": "image",
"name": "keyboard",
"size": 2131742,
"human_readable_size": "2.03 MB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/29/Fantasticheskie_kartinki_dlja_monitora_68_96.jpg",
"width": 2560,
"height": 1600,
"mode": "RGB",
"thumbnails": [
{
"id": 313,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 314,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 315,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 316,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"categories_data": [
{
"id": 2,
"name": "Technology"
},
{
"id": 1,
"name": "Computer"
}
],
"created_at": "2025-11-29T16:00:49.908287Z",
"updated_at": "2025-11-29T18:27:39.746950Z"
}
]
}