gwa / wp-posts-api
wp-plugin-use-your-drive
v1.2.0
2017-07-07 08:19 UTC
Requires
- composer/installers: ~1.2.0
This package is not auto-updated.
Last update: 2024-09-14 20:20:14 UTC
README
基本的API,以JSON格式提供最近的帖子预览。
最新帖子
返回最新的10篇帖子,从旧的到新的。
http://example.com/?gwasw_api=1
响应
{
"posts": [{
"id": 1,
"guid": "http:\/\/example.com\/?p=1",
"title": "Hello world!",
"excerpt": "Welcome to WordPress. This is your first post. Edit or delete it, then start writing!",
"published_gmt": "2017-03-19 06:33:26",
"url": "http:\/\/example.com\/2017\/03\/hello-world\/",
"imageurl": "http:\/\/localhost\/wp_test\/wp-content\/uploads\/2017\/03\/photo.jpeg",
"tags": ["mytag"]
}, {
...
}]
}
自ID以来的帖子
返回ID大于所传递的ID的10篇帖子,从旧的到新的。
http://example.com/?gwasw_api=1&idsince=[integer]
响应
见上文。
错误
{
"error": "post does not exist"
}
单个帖子
返回单个帖子
http://example.com/?gwasw_api=1&idpost=[integer]
响应
{
"post": {
"id": 1,
"guid": "http:\/\/example.com\/?p=1",
"title": "Hello world!",
"excerpt": "Welcome to WordPress. This is your first post. Edit or delete it, then start writing!",
"published_gmt": "2017-03-19 06:33:26",
"url": "http:\/\/example.com\/2017\/03\/hello-world\/",
"imageurl": "http:\/\/localhost\/wp_test\/wp-content\/uploads\/2017\/03\/photo.jpeg",
"tags": ["mytag"]
}
}
错误
{
"error": "post does not exist"
}