際際滷

際際滷Share a Scribd company logo
WordPress REST API
WordPress REST API
WordPress REST API
WordPress REST API
WordPress REST API
束We need to work hard to harmonize the REST API plugin
And the WordPress.com REST API損
https://wordpress.org/plugins/json-rest-a
https://github.com/WP-API/WP-API (maste
http://wp-api.org
 丕丐丐弌亂!
WP JSON REST API  仆舒亰于舒仆亳亠
JSON-REST-API  namespace
WP-API.org  舒亶
WordPress REST API
仗仂仍亳 于亠 亰舒仗亳亳
GET /wp-json/posts
仗仂仍亳 亰舒仗亳亳 亳亰 从舒亠亞仂亳亳 1
GET /wp-json/posts?filter[cat]=1
仗仂仍亳 亰舒仗亳 仗仂 ID
GET /wp-json/posts/123
WordPress REST API
GET-仗舒舒仄亠 filter
GET /wp-json/posts
?filter[posts_per_page]=5
&filter[cat]=1
&filter[order]=asc
* 仆亠 于亠 仗舒舒仄亠 WP_Query 舒弍仂舒ム 于 filter
1. Cookie
2. OAuth1 (OAuth plugin + WP-CLI)
3. HTTP Basic Auth (Basic Auth plugin
POST PUT DELETE
* 亳亰仄亠仆磳仄 亰舒仗亳  ID 1234
仂仍亠仆亳亠 meta 亰舒仗亳亳:
GET /wp-json/posts/<id>/meta
Cookie-舒于仂亳亰舒亳 / JavaScript-亰舒仗仂
wp_enqueue_script( wp_api );
jQuery.ajax({
url: WP_API_Settings.root + /posts/1234
,method: PUT
,beforeSend: function(xhr) {
xhr.setRequestHeader(X-WP-Nonce, WP_API_Settings.nonce)
}
,contentType: application/json
,dataType: json
,data: {ID: 1234, title: sometitle, content_raw: text}
});
弍亠从 WP_API_Settings
OAuth1-plugin: https://github.com/WP-API/OAuth1
亠仂弍仂亟亳仄仂 仗仂亟从仍ム亠仆亳亠 仗仍舒亞亳仆舒 WP-CLI
$ wp oauth1 add
仍舒亞亳仆 仂 从仂仄舒仆亟 WP-API: Basic Auth
https://github.com/WP-API/Basic-Auth
WordPress REST API
WordPress REST API
Ryan McCue 亳 亟亞亳亠 舒于仂
WordPress REST API
WordPress REST API
WordPress REST API
WordPress REST API
弌仗舒亳弍仂 亰舒 于仆亳仄舒仆亳亠!

More Related Content

WordPress REST API