Get All Blog Posts
Retrieve a list of blog posts with optional filtering, searching, and pagination.
HTTP Request
GET/api/shop/blog/posts
Authorization
Authorization
- Required: No
- Permission: None (public access) or Authenticated users
- Authentication: None or Token-based authentication
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`, `title`, `slug`, `body`, `categories__name. |
| ordering | string | — | Order results by (`title`,`views`, `created_at`, `updated_at`,`categories__id`, `categories__name`, `author__id`, `author__username`, `author__first_name`, `author__last_name`). |
| views_min | integer | — | Minimum number of views to filter results. |
| views_max | integer | — | Maximum number of views to filter results. |
| has_image | boolean | — | Filter results to only include posts with an image. |
| category_id | integer | - | Filter results by category |
| category_in | string | - | Filter by a list of comma-separated category ids (eg 1,2,3) |
| category_tree_id | integer | - | Filter posts by category id and all its children categories |
| id_min | integer | — | Minimum ID of the blog post. |
| id_max | integer | — | Maximum ID of the blog post. |
| created_date | string | — | Exact creation date (`YYYY-MM-DD`). |
| updated_date | string | — | Exact last update date (`YYYY-MM-DD`). |
| created_from | string | — | Start date for blog posts created after this date (`YYYY-MM-DD`). |
| updated_from | string | — | Start date for blog posts updated after this date (`YYYY-MM-DD`). |
| created_to | string | — | End date for blog posts created before this date (`YYYY-MM-DD`). |
| updated_to | string | — | End date for blog posts updated before this date (`YYYY-MM-DD`). |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2api = requests.Session()
3response = api.get('http://www.example.com/api/shop/blog/posts', params={
4 'limit': 5,
5 'ordering': 'created_at',
6 'search': 'example'
7})
8print(response.json())1curl "http://www.example.com/api/shop/blog/posts?limit=5&ordering=created_at&search=example"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 Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the blog post |
| title | String | Title of the blog post |
| slug | String | Slug for the blog post |
| human_readable_views | String | Human-readable format of the views (e.g., 1.2K) |
| excerpt | String | Short summary or excerpt of the blog post |
| truncated_excerpt | String | Truncated version of the excerpt (e.g., first 100 characters) |
| author | Object | Author details including `id`, `username`, and `full_name` |
| featured_image | Object or null | Details of the featured image or null if none exists |
| categories | Array[Object] | List of post categories |
| 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 |
| username | String | Username of the author |
| full_name | String | Full name of the author (first and last name combined) |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (e.g., image/jpeg) |
| name | String | Original file name |
| size | Integer | File size in bytes |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels |
| height | Integer | Image height in pixels |
| mode | String | Color mode (e.g., RGB, CMYK) |
| thumbnails | List of thumbnail objects | Imgae thumbnails |
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) |
Category Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the post category |
| name | String | Name of the post category |
| slug | String | Slug of the post category |
Example Response
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 47,
"title": "blog-name1",
"slug": "blog-name100000002",
"human_readable_views": "0",
"excerpt": "test",
"truncated_excerpt": "test",
"author": {
"id": 1,
"username": "behrooz3500",
"full_name": "behrooz ghorbanie"
},
"featured_image": {
"id": 1,
"type": "image",
"name": "logitech-logo",
"size": 2763,
"human_readable_size": "2.70 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech.png",
"width": 287,
"height": 176,
"mode": "P",
"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": [
{
"id": 1,
"name": "Computer",
"slug": "computer"
},
{
"id": 2,
"name": "Technology",
"slug": "technology"
}
],
"created_at": "2025-12-03T13:30:45.856253Z",
"updated_at": "2025-12-03T13:30:45.856297Z"
},
{
"id": 43,
"title": "blog-name1",
"slug": "blog-name100000000",
"human_readable_views": "0",
"excerpt": "test",
"truncated_excerpt": "test",
"author": {
"id": 1,
"username": "behrooz3500",
"full_name": "behrooz ghorbanie"
},
"featured_image": {
"id": 1,
"type": "image",
"name": "logitech-logo",
"size": 2763,
"human_readable_size": "2.70 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech.png",
"width": 287,
"height": 176,
"mode": "P",
"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": [
{
"id": 1,
"name": "Computer",
"slug": "computer"
},
{
"id": 2,
"name": "Technology",
"slug": "technology"
}
],
"created_at": "2025-12-01T10:55:30.606902Z",
"updated_at": "2025-12-01T10:55:30.606909Z"
},
{
"id": 40,
"title": "رایانش کوانتومی، حباب هوش مصنوعی را میترکاند؛ ادعای مدیرعامل سابق اینتل",
"slug": "quantum-computing-pop-ai-bubble-intel-ex-ceo",
"human_readable_views": "0",
"excerpt": "<p><em>پت گلسینگر</em>، مدیرعامل پیشین اینتل، ادعاهای تازه‌ای درباره‌ی پایان شور و شوق هوش مصنوعی مطرح کرده و می‌گوید «یک جهش کوانتومی» این حباب را می‌ترکاند.</p>",
"truncated_excerpt": "<p><em>پت گلسینگر</…",
"author": {
"id": 2,
"username": "staffer",
"full_name": "عماد رخشانی"
},
"featured_image": null,
"categories": [],
"created_at": "2025-11-29T15:58:40.037053Z",
"updated_at": "2025-11-29T15:58:40.037058Z"
}
]
}
Notes
- If is_published is False, the blog post will not appear in this list for unauthenticated users or users without proper permissions. To view unpublished posts, authentication is required.
- The
excerptfield provides a short summary of the blog post. - The
truncated_excerptfield provides a shortened version of the excerpt, useful for previews. - The
human_readable_viewsfield provides a more understandable view count, making it easier for users to grasp the post's popularity. - The
featured_imagefield contains the URL of the featured image for the blog post, if available. - The
created_atandupdated_atfields are automatically set to the current timestamp when the blog post is created or updated. - To prevent excessive data transfer, the
bodyfield is not included in the list response. It can be retrieved separately using theRetrieve a Blog Postendpoint.