Skip to main content

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

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page.
offsetinteger0Number of results to skip before returning results.
searchstringSearch term to lookup results by `id`, `title`, `slug`, `body`, `categories__name.
orderingstringOrder results by (`title`,`views`, `created_at`, `updated_at`,`categories__id`, `categories__name`, `author__id`, `author__username`, `author__first_name`, `author__last_name`).
views_minintegerMinimum number of views to filter results.
views_maxintegerMaximum number of views to filter results.
has_imagebooleanFilter results to only include posts with an image.
category_idinteger-Filter results by category
category_instring-Filter by a list of comma-separated category ids (eg 1,2,3)
category_tree_idinteger-Filter posts by category id and all its children categories
id_minintegerMinimum ID of the blog post.
id_maxintegerMaximum ID of the blog post.
created_datestringExact creation date (`YYYY-MM-DD`).
updated_datestringExact last update date (`YYYY-MM-DD`).
created_fromstringStart date for blog posts created after this date (`YYYY-MM-DD`).
updated_fromstringStart date for blog posts updated after this date (`YYYY-MM-DD`).
created_tostringEnd date for blog posts created before this date (`YYYY-MM-DD`).
updated_tostringEnd date for blog posts updated before this date (`YYYY-MM-DD`).

Example Requests

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

Response Fields

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of BlogPost objects

BlogPost Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the blog post
titleStringTitle of the blog post
slugStringSlug for the blog post
human_readable_viewsStringHuman-readable format of the views (e.g., 1.2K)
excerptStringShort summary or excerpt of the blog post
truncated_excerptStringTruncated version of the excerpt (e.g., first 100 characters)
authorObjectAuthor details including `id`, `username`, and `full_name`
featured_imageObject or nullDetails of the featured image or null if none exists
categoriesArray[Object]List of post categories
created_atString (ISO 8601)Timestamp when the blog post was created
updated_atString (ISO 8601)Timestamp when the blog post was last updated

Author Data Structure

FieldTypeDescription
idIntegerUnique ID of the author
usernameStringUsername of the author
full_nameStringFull name of the author (first and last name combined)

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)
thumbnailsList of thumbnail objectsImgae thumbnails

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

Category Object Data Structure

FieldTypeDescription
idIntegerUnique ID of the post category
nameStringName of the post category
slugStringSlug 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>، مدیرعامل پیشین اینتل، ادعاهای تازه&zwnj;ای درباره&zwnj;ی پایان شور و شوق هوش مصنوعی مطرح کرده و می&zwnj;گوید &laquo;یک جهش کوانتومی&raquo; این حباب را می&zwnj;ترکاند.</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 excerpt field provides a short summary of the blog post.
    • The truncated_excerpt field provides a shortened version of the excerpt, useful for previews.
    • The human_readable_views field provides a more understandable view count, making it easier for users to grasp the post's popularity.
    • The featured_image field contains the URL of the featured image for the blog post, if available.
    • The created_at and updated_at fields are automatically set to the current timestamp when the blog post is created or updated.
    • To prevent excessive data transfer, the body field is not included in the list response. It can be retrieved separately using the Retrieve a Blog Post endpoint.