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
Jack Lenox - Intro to the REST API - WordCamp A...
Search
WordPress Greek Community
PRO
November 19, 2016
Programming
400
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jack Lenox - Intro to the REST API - WordCamp Athens 2016
WordPress Greek Community
PRO
November 19, 2016
More Decks by WordPress Greek Community
See All by WordPress Greek Community
Filippos Karailanidis - Beyond ChatGPT: AI Toolkit for the WordPress Developer
wpgr
PRO
0
45
Orestis Samaras - Modern WordPress Development with Composer
wpgr
PRO
0
32
Eleni Tsertou - Ταχύτερο website με Persistent Object Cache: Μύθος ή Αλήθεια;
wpgr
PRO
0
34
George Korakas - WordPress Security 2025: From Real Threats to Practical Defenses
wpgr
PRO
0
44
Δημήτρης Καρβούνης - Πέρα από το Admin Panel: Πώς να μιλήσεις στο WordPress σαν Developer μέσω REST API
wpgr
PRO
0
28
Αναστασία Αδαμούδη - Δημιουργία σύνθετου μενού πλοήγησης σε block θέματα
wpgr
PRO
0
21
Νίκος Μαυράκης - Κοστολογώντας τη δημιουργικότητα
wpgr
PRO
0
42
Jovana Smoljanovic Tucakov - AI vs. Human Content: What Works, What Backfires, and What’s Next
wpgr
PRO
0
41
Λεωνίδας Μηλώσης - Optimize – optimize – optimize: Caring for performance of your WordPress plugin or website
wpgr
PRO
0
34
Other Decks in Programming
See All in Programming
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
160
琵琶湖の水は止められても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
330
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
260
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
320
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
2.5k
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
0
110
初めてのKubernetes 本番運用でハマった話
oku053
0
120
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
380
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
650
We Are The Robots
honzajavorek
0
280
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
A better future with KSS
kneath
240
18k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Visualization
eitanlees
152
17k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
590
WCS-LA-2024
lcolladotor
0
710
Transcript
An introduc on to the WordPress REST API Jack Lenox
(@jacklenox) WordCamp Athens 2016
I Greece!
1. The case for a WordPress REST API
What is a REST API?
It stands for REpresenta onal State Transfer Applica on Programming
Interface
Centred around verbs GET POST UPDATE PUT DELETE etc. Different
ways to interact with your data
Usually responds in XML or JSON format XML (Extensible Markup
Language) HTML RSS JSON (JavaScript Object Notation)
Why does WordPress need one?
None
MoMA in New York (c. 2009) Their developers wanted to
use: WordPress as the CMS Ruby to build the front-end Why? I don't know... but they did
None
None
None
Internet of things
So, what is the WordPress REST API?
None
None
Merge meline WordPress 4.4 (8 December 2015) Infrastructure merged No
endpoints WordPress 4.7 (due 6 December 2016) Endpoints merged!
2. How the WordPress REST API works (aka, what the
heck is an endpoint?)
End‐what? REST APIs interprets a URL, and return a response
Not wildly different to RSS Sample request to fetch some posts: wc-athens.dev/wp-json/wp/v2/posts
[ { "id": 1, "date": "2016-11-18T14:08:53", "date_gmt": "2016-11-18T14:08:53", "modified": "2016-11-18T14:08:53",
"modified_gmt": "2016-11-18T14:08:53", "slug": "hello-world", "type": "post", "link": "http://wp-rest-api-demo.dev/2016/11/18/hello-wor "title": { "rendered": "Hello world!" }, "content": { "rendered": "<p>Welcome to WordPress. This is your fi "protected": false } } ]
More endpoints... Single post: wc-athens.dev/wp-json/wp/v2/posts/1 All pages: wc-athens.dev/wp-json/wp/v2/pages All users:
wc-athens.dev/wp-json/wp/v2/users All categories: wc-athens.dev/wp-json/wp/v2/categories
Moar verbs! By default, our calls to the REST API
are GET requests. But we can do a lot more: POST PUT UPDATE DELETE
Authen ca on!
A few ways to authen cate Basic Authen ca on
Quick and dirty Cookie Authen ca on Good, especially for themes and plugins OAuth 1.0 A bit complicated, but versatile OAuth 2 Less complicated than OAuth 1, but requires HTTPS
Brokered Authen ca on apps.wp-api.org
Modifying endpoints
3. Uses for the WordPress REST API
Custom wp‐admin interfaces Calypso HappyTables
Mobile applica ons WordPress apps for iOS and Android Vienna
Themes Picard Anadama Foxhound
Plugins WooCommerce Syndication EDD
Enterprise Guggenheim Quartz Google IO (not WordPress, but...)
Very exci ng mes ahead!
Further reading, and any ques ons? v2.wp-api.org WordPress.tv (search "REST
API") javascriptforwp.com
Ευχαριστώ πολύ! @jacklenox