博客
Blog API 用于获取店铺的博客以及某个博客下的文章。两个 endpoint 匿名访客都可以调用。
所有 Ajax API 请求应使用多语言 URL,以便为访客提供一致的体验。
获取店铺博客列表
GET /{locale}/api/front/blogs
获取店铺的博客列表,包含每个博客的文章数和前台路径。没有参数。
请求示例
fetch(window.SHOPLAZZA.routes.root + '/api/front/blogs')
.then((response) => response.json())
.then((data) => {
// do something...
});
响应
- 数据结构
- 示例
- Array [
- ]
countnumber
返回的博客数量。
blogs object[]
文章所属的博客。
idstring
博客的 ID。
titlestring
博客标题。
descriptionstring可空
博客的描述。
seo_titlestring
SEO 标题。
seo_descriptionstring
SEO 描述。
seo_keywordsundefined[]
SEO 关键词。
handlestring
用于资源链接的 handle(URL 友好别名)。
seo_urlstring
博客的相对地址。
article_countnumber
博客下的文章数量。
created_atstring
创建时间(ISO-8601 格式)。
updated_atstring
最后更新时间(ISO-8601 格式)。
{
"count": 1,
"blogs": [
{
"id": "9e1a47ab-e22b-4370-bbf0-2309cc3d6c72",
"title": "Ajax API Probe",
"description": null,
"seo_title": "",
"seo_description": "",
"seo_keywords": [],
"handle": "ajax-probe",
"seo_url": "/blogs/ajax-probe",
"article_count": 1,
"created_at": "2026-09-02T13:42:08Z",
"updated_at": "2026-09-02T13:42:24Z"
}
]
}
获取博客下的文章列表
GET /{locale}/api/front/blogs/{blog_slug}/articles
获取某个博客下的文章列表,blog_slug 取博客的 handle。
请求示例
fetch(window.SHOPLAZZA.routes.root + '/api/front/blogs/ajax-probe/articles?page=1&per_page=5')
.then((response) => response.json())
.then((data) => {
// do something...
});
请求参数
blog_slugstring
博客的 handle。
pagenumber
返回第几页文章。
per_pagenumber
每页返回的文章数。
响应
- 数据结构
- 示例
- Array [
- Array [
- ]
- ]
countnumber
返回的文章数量。
articles object[]
文章列表。
idstring
文章的 ID。
titlestring
文章标题。
excerptstring
文章的简短摘要。
authorstring
文章作者。
imagestring可空
文章的配图。
published_atstring可空
发布时间(ISO-8601 格式)。
handlestring
用于资源链接的 handle(URL 友好别名)。
urlstring
文章的相对地址。
blogs object[]
文章所属的博客。
idstring
博客的 ID。
titlestring
博客标题。
urlstring
博客的相对地址。
handlestring
用于资源链接的 handle(URL 友好别名)。
{
"count": 1,
"articles": [
{
"id": "b90f0520-afea-4efd-8c92-3e5751490317",
"title": "Ajax API Probe Article",
"excerpt": "Sample article for Ajax API docs.",
"author": "Docs",
"image": null,
"published_at": null,
"handle": "ajax-probe-article",
"url": "/blog/ajax-probe-article",
"blogs": [
{
"id": "9e1a47ab-e22b-4370-bbf0-2309cc3d6c72",
"title": "Ajax API Probe",
"url": "/blogs/ajax-probe",
"handle": "ajax-probe"
}
]
}
]
}