Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WP API (JSON REST API) at WordCamp Hampton Roads
Search
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
410
WordCamp Miami 2015
techvoltz
0
220
The awesome guide to contributing to WordPress
techvoltz
2
240
Getting started with WordPress development
techvoltz
0
80
WordSesh 2 Creatively Creating Custom Post Types
techvoltz
0
270
Creatively Creating Custom Post Types
techvoltz
0
89
Other Decks in Programming
See All in Programming
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
240
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.7k
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
260
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
550
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
590
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
630
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
670
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
490
FDEが実現するAI駆動経営の現在地
gonta
2
280
VibeCodingからAgenticWorkflowへ
starfish719
0
350
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
610
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
410
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
440
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
We Are The Robots
honzajavorek
0
290
Skip the Path - Find Your Career Trail
mkilby
1
180
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
310
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
230
Test your architecture with Archunit
thirion
1
2.3k
Bash Introduction
62gerente
615
220k
Rails Girls Zürich Keynote
gr2m
96
14k
AI: The stuff that nobody shows you
jnunemaker
PRO
9
900
Building Applications with DynamoDB
mza
96
7.2k
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