/get/blog_post/{id} - Get article by ID

Overview

The /get/blog_post/{id} endpoint retrieves detailed information about a specific blog post or article by its ID.

Purpose

Endpoint

GET /get/blog_post/{id}

Parameters

Path parameters

id (string, required)

The article's composite ID in the format <site_id>_<wp_id>.

Format: {site_id}_{wordpress_id}

Examples:

Validation: Must match the pattern {number}_{number}. Invalid formats will return an error.


Query parameters

sourceFields (string, optional)

Return only specific fields from the _source object using dot notation (comma-separated).

Purpose: Optimize response payload size by requesting only needed fields

Examples:


Response format

Success response structure

{
  "_index": "fnugg_blog",
  "_type": "blog_post",
  "_id": "1_12345",
  "_version": 1,
  "found": true,
  "_source": {
    "title": "Guide til Trysil: Alt du trenger å vite",
    "description": "Komplett guide til Norges største alpinområde. Her får du alle tips og råd for en perfekt skiopplevelse i Trysil...",
    "images": [
      {
        "url": "https://example.com/article-image.jpg",
        "caption": "Fantastisk utsikt fra toppen",
        "width": 1920,
        "height": 1080
      }
    ],
    "video": {
      "url": "https://youtube.com/watch?v=abc123",
      "provider": "youtube",
      "thumbnail": "https://img.youtube.com/vi/abc123/maxresdefault.jpg"
    },
    "timezone": "Europe/Oslo",
    "date": "2024-11-01T10:30:00",
    "modified": "2024-11-05T14:20:00",
    "type": "blog_post",
    "site_id": "1",
    "id": 12345,
    "author": {
      "first_name": "Ole",
      "last_name": "Hansen",
      "name": "Ole Hansen"
    }
  }
}

Error response (invalid ID format)

{
  "error": "Invalid article ID. Must follow the format <resort_id>_<article_id>."
}

Error response (not found)

{
  "error": "Article with ID '1_99999' was not found.",
  "error_key": "article_not_found",
  "id": "1_99999"
}

Response fields

Top level fields

_source fields

Content

Identification

Media

Metadata

Author


Example requests

Get complete article

GET /get/blog_post/1_12345

Returns all fields for article with ID "1_12345".


Get article with specific fields only

GET /get/blog_post/1_12345?sourceFields=title,description,date,author

Returns only title, description, publication date, and author information.


Get article preview data

GET /get/blog_post/14_98765?sourceFields=title,description,images,date

Returns data suitable for article previews/cards (title, excerpt, image, date).


Get article media

GET /get/blog_post/1_12345?sourceFields=images,video

Returns only media assets (images and video).


Use cases

  1. Display article detail page: Fetch complete article data for full article view
  2. Article preview cards: Use sourceFields=title,description,images,date for list views
  3. Social media sharing: Use sourceFields=title,description,images for metadata
  4. RSS/feed generation: Use sourceFields=title,description,date,author for feed items
  5. Search results: Use sourceFields=title,description for search result snippets
  6. Related articles: Fetch multiple articles with filtered fields for sidebar recommendations

Notes