Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WP API (JSON REST API) at WordCamp Hampton Roads
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Nikhil Vimal
October 17, 2015
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WP API (JSON REST API) at WordCamp Hampton Roads
Nikhil Vimal
October 17, 2015
More Decks by Nikhil Vimal
See All by Nikhil Vimal
Utah WordPress Meetup talk (June 2015)
techvoltz
1
420
WordCamp Miami 2015
techvoltz
0
220
The awesome guide to contributing to WordPress
techvoltz
2
250
Getting started with WordPress development
techvoltz
0
82
WordSesh 2 Creatively Creating Custom Post Types
techvoltz
0
270
Creatively Creating Custom Post Types
techvoltz
0
91
Other Decks in Programming
See All in Programming
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
6k
golang-bob.pdf
iwatsukayura
0
150
AmebaブログはKMPから卒業します
kmars0605
0
310
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
390
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
240
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
220
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
140
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.9k
Jetpack Compose Mechanisms
skydoves
3
900
Performance Optimization With LLMs
xleitix
0
230
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
280
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
140
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
340
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
The untapped power of vector embeddings
frankvandijk
2
2k
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Color Theory Basics | Prateek | Gurzu
gurzu
1
500
Docker and Python
trallard
47
4.2k
Visualization
eitanlees
153
17k
ラッコキーワード サービス紹介資料
rakko
5
5.6M
Become a Pro
speakerdeck
PRO
31
6.3k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Bash Introduction
62gerente
615
220k
Transcript
Demo Time!
POST, PUT, DELETE, GET The WP API with Nikhil Vimal
Hi! I’m Nikhil V. I’m 16 and I build stuff.
http://v2.wp-api.org/
None
None
https://github.com/WP-API/WP-API
REST? RESTFUL? SLEEP?
Representational state transfer
Something…Something…HTTP
None
None
POST
DELETE
PUT
GET
/wp-json ?
NOPE!
None
/wp-json/wp/v2/posts
$.ajax({ method: "post", url: ‘http://local.dev/wp-json/ wp/v2/posts', data: data, beforeSend: function
( xhr ) { xhr.setRequestHeader( 'X-WP-Nonce', POST_SUBMITTER.nonce ); }, success : function( response ) { console.log( response ); alert( POST_SUBMITTER.success ); }, fail : function( response ) { console.log( response ); alert( POST_SUBMITTER.failure ); } });
So…why does this matter to me?
With great power comes great…
<?php function my_rest_prepare_post( $data, $post, $request ) { $_data =
$data->data; $thumbnail_id = get_post_thumbnail_id( $post->ID ); $thumbnail = wp_get_attachment_image_src( $thumbnail_id ); $_data['featured_image_thumbnail_url'] = $thumbnail[0]; unset($_data['featured_image']); $data->data = $_data; return $data; } add_filter( 'rest_prepare_post', 'my_rest_prepare_post', 10, 3 );
Please Mr. Postman
Slack + WordPress
None
wp.posts().post({ content_raw: 'my content’, title: ‘look at me go’ })
Custom Dashboards!
None
Authentication…UGH
None
http://www.sitepoint.com/wp-api-and- oauth-using-wordpress-without- wordpress/
None
add_filter('rest_enabled', '__return_false');
Fin @TechVoltz