Skip to main content

Retrieve Blog

Retrieve a specific blog post by its unique ID.

HTTP Request

GET/api/blog/posts/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the blog post to retrieve

Example Requests

1import requests
2response = requests.get('http://www.example.com/api/blog/posts/1', headers={
3  'Authorization': 'Token <your_api_key>'
4})
5
6print(response.json())

Status Codes

CodeDescription
200Blog post retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Not found — blog post does not exist
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the blog post
titleStringTitle of the blog post
slugStringSlug for the blog post
viewsIntegerNumber of views the blog post has received
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)
author_dataObjectAuthor details including `id`, `username`, and `full_name`
featured_image_dataObjectFeatured image data including `id`, `type`, `name`, `size`, `human_readable_size`, `f`, `width`, `height`, and `mode`
bodyStringFull content of the blog post
truncated_bodyStringTruncated version of the body (e.g., first 200 characters)
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)

Featured Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the featured 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)