1.0 WP User
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/users
return: (array) user
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/users/1
return: (object) user
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/users/me
return: (object) status
[POST] http://127.0.0.1/wordpress.002/wp-json/wp/v2/users
params: username | email | password | slug=subscriber
return: (object) user
description: create new user group "Guest" and send Guest's token, so public users can register and read posts
[PUT] http://127.0.0.1/wordpress.002/wp-json/wp/v2/users/5
params: username | email | password | slug=subscriber
return: (object) user
2.0 JWT Login
參見: Wordpress Restful API Auth (https://www.cnblogs.com/chenkuang/p/17787626.html)
[POST] http://127.0.0.1/wordpress.002/wp-json/jwt-auth/v1/token
params: username | password
return: (object) user
[POST] http://127.0.0.1/wordpress.002/wp-json/jwt-auth/v1/token/validate
return: (object) status
3.0 WP Post + ACF
ACF -> Group Setting -> Show in REST API
[POST] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes
params: title | content | status=publish | acf=JSON
return: (object) post
[Delete] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes/50
return: (object) post
[PUT] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes/50
params: title | content | status=publish | acf=JSON
return: (object) post
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes
return: (array) post
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes/20
return: (object) post
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes?_fields=author,id,excerpt,title,content,link
return: (array) post - specific fields
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes/20?_fields=acf&acf_format=standard
return: (object) post - ACF fields
4.0 CROS
&_jsonp=jsonpData
return: (jsonpData) StringData
5.0 Pagination
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes?page=4&per_page=2
params: page | per_page
return: (array) post
header: X-WP-Total, X-WP-TotalPages
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes?page=1&per_page=2&orderby=id&order=desc
params: orderby=date,relevance,id,include,title,slug | order=asc,desc
return: (array) post
header: X-WP-Total, X-WP-TotalPages
6.0 Embed
可用 acf_format=standard 取代 Embed。
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/smokes?_embed
params: _embed
return: (array) post
7.0 Categories
[GET] http://example.com/wp-json/wp/v2/categories
return: (array) categories
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/categories?parent=0
params: parent
return: (array) categories
[GET] http://127.0.0.1/wordpress.002/wp-json/wp/v2/assets?categories=3,4
params: categories
return: (array) post
8.0 Show ACF on Admin Col
9.0 Categories vs Tags
- Categories是層級關系。
- Tags是離散關系。