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
240
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
90
Other Decks in Programming
See All in Programming
すこし踏み込む CancellationToken
htkym
2
1.7k
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
470
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Simple Storage Service(S3) is not simple
iwatsukayura
0
230
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
360
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
160
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5k
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
120
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
速習iPhone Duo対応
yuukiw00w
2
970
contenteditable と日本語入力に向き合う
colorful12
0
180
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.3k
Typedesign – Prime Four
hannesfritz
42
3.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
720
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
510
New Earth Scene 8
popppiees
4
2.7k
GraphQLとの向き合い方2022年版
quramy
50
15k
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