The Vi
HomeAlgorithmsAboutAPI
🇻🇳 Tiếng Việt🇬🇧 English

© 2026 All rights reserved · Nguyen Duong The Vi

API Documentation

How to use the public APIs to list posts and fetch a single post on this site.

Overview

Every endpoint returns a unified JSON envelope with three fields: success, message, and data. On failure, success is false and data is null.

Base URL
https://www.nguyenduongthevi.click/api
{
    "success": true,
    "message": "...",
    "data": { ... }
}

Endpoints

  • GET/api/posts— List posts
  • GET/api/posts/{slug}— Get a single post
GET/api/posts

List posts

Returns a paginated list of posts. Supports selecting the page and items per page.

Parameters

NameInTypeRequiredDefaultDescription
pagequerynumberNo1Page number to fetch, starting at 1.
limitquerynumberNo10Number of posts per page. Allowed range: 1 to 100.

Example request

curl https://www.nguyenduongthevi.click/api/posts?page=1&limit=10

Example response

{
    "success": true,
    "message": "Posts fetched",
    "data": {
        "items": [
            {
                "slug": "7-a3-injection-cross-site-scripting",
                "title": "A3 — Injection: Cross-Site Scripting",
                "date": "2024-05-12",
                "description": "Tổng quan về tấn công XSS và cách phòng tránh...",
                "tags": [
                    "security",
                    "owasp",
                    "xss"
                ],
                "thumbnail": "/posts/xss.jpg",
                "readTime": "6",
                "author": "Nguyễn Dương Thế Vĩ"
            }
        ],
        "totalItems": 23,
        "page": 1,
        "perPage": 10,
        "totalPages": 3
    }
}
Try it
GET/api/posts/{slug}

Get a single post

Returns the frontmatter and rendered HTML body of a post by slug.

Parameters

NameInTypeRequiredDefaultDescription
slugpathstringYes—Unique slug of the post — lowercase letters, digits, and hyphens.

Example request

curl https://www.nguyenduongthevi.click/api/posts/7-a3-injection-cross-site-scripting

Example response

{
    "success": true,
    "message": "Post fetched",
    "data": {
        "slug": "7-a3-injection-cross-site-scripting",
        "title": "A3 — Injection: Cross-Site Scripting",
        "date": "2024-05-12",
        "description": "Tổng quan về tấn công XSS và cách phòng tránh...",
        "tags": [
            "security",
            "owasp",
            "xss"
        ],
        "thumbnail": "/posts/xss.jpg",
        "readTime": "6",
        "author": "Nguyễn Dương Thế Vĩ",
        "contentHtml": "<h2>Giới thiệu</h2><p>...</p>"
    }
}
Try it