SlideShare a Scribd company logo
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Takayuki Shimizu @shimy_net
Solutions Architect, Amazon Web Services Japan K.K.
July 10, 2016
WordPress RESTful API &
Amazon API Gateway
WordCamp Kansai 2016
English version
About Me
• Takayuki Shimizu @shimy_net
AWS Comedian
• Funny presentations with useless technology
• http://www.slideshare.net/shimy_net
Kickstart EC2 KA-ME-HA-ME-HA by Kinesis Bike with DynamoDB Pythagora Switch Automation
Drawing Robot with AWS IoT
AWS IoT
Browser Robot arm
What to Expect from the Session
1. What’s REST API ?
2. Display external data on WordPress
3. Why Amazon API Gateway ?
4. Build Serverlss REST API
5. Patterns with WordPress
6. Summary
• REpresentational State Transfer
• Web architecture as proposed by Roy Fielding
• APIs that follow the principles of REST are called RESTful
What’s REST API ?
Resources
• “Resource” is any information that has a name.
• Weather in Osaka
• Today's News
• Amazon's stock price
• “Resource” is represented by a “URI”
• URI indicates the Resource itself
• URI and resource have a one-to-one relationship
• ”State" can change with time and conditions, but
its ”Meaning" will never change.
URI
• Uniform Resource Identifier
• URI identifies the Resource
• Example) https://api.example.com/resouces/1234
• Use only Nouns
• Not actions
• The basic rule is that there are no verbs in the URI path
HTTP method
• Select HTTP method to be used depending on what is to be
processed with the resource indicated by the URI.
• Use the methods defined in HTTP.
• GET / POST / PUT / DELETE or PATCH are mainly used.
HTTP method Meaning CRUD
GET Get a resource READ
POST Create a child resource CREATE
PUT Update a resource (existing
URI)
Create a resource (new URI)
UPDATE
CREATE
DELETE Delete a resource DELETE
PATCH Partially update a resource UPDATE
HTTP status code
HTTP status code Meaning Example
200 OK The request has succeeded. Referencing resource information via
GET
201 CREATED The request has succeeded and a new resource has been
created as a result.
Creating resources via POST
204 NO CONTENT There is no content to send for this request, but the
headers may be useful.
Delete resources via DELETE
400 BAD REQUEST The server could not understand the request due to
invalid syntax.
When you use a method that is not
defined, or when the JSON format of
the request body is wrong
401 UNAUTHORIZED This response means "unauthenticated". When a URL that requires
authentication is accessed without
authentication
403 FORBIDDEN The client does not have access rights to the content When you access a resource for which
you do not have access rights
404 NOT FOUND The server can not find the requested resource. GET to a non-existent resource
409 CONFRICT This response is sent when a request conflicts with the
current state of the server.
When the data you are trying to
create or update gives an error due to
unique constraints, etc.
500 INTERNAL SERVER
ERROR
internal error in the server Server-side errors in general, including
exceptions during processing
Stateless
• No state between client and server
• (Ideally) every request should contain all the
information necessary to process it
• No state makes it easier to have scalability
Stateful
Hello
Which side dishes would you like?
French fries
Which drink?
Thatʼs all
Coke
Anything else?
The check is 1000 yen
Give me a burger combo
Stateless
Give me a burger combo
Give me a burger combo
with French fries
Give me a burger combo
with French fries and Coke
Give me a burger combo
with French fries and Coke
Hello
Which side dishes would you like?
Which drink?
Anything else?
The check is 1000 yen
API proliferation
The number of published APIs is growing rapidly
2418
10302
0
2000
4000
6000
8000
10000
12000
Jun-05
Oct-05
Feb-06
Jun-06
Oct-06
Feb-07
Jun-07
Oct-07
Feb-08
Jun-08
Oct-08
Feb-09
Jun-09
Oct-09
Feb-10
Jun-10
Oct-10
Feb-11
Jun-11
Oct-11
Feb-12
Jun-12
Oct-12
Feb-13
Jun-13
Oct-13
* Data from ProgrammableWeb
How to display external data on WordPress
Weather information
3rd party API
• Backend (wp_remote_get, wp_remote_post, etc.)
• Frontend (Ajax with jQuery, Angular JS, React, etc.)
How to embed external data
JSON
3rd party API
Browser
HTML
Browser
3rd party API
HTML
JSON
• Backend (wp_remote_get, wp_remote_post, etc.)
• Frontend (Ajax with jQuery, Angular JS, React, etc.)
There is no convenient 3rd party API...
JSON
Browser
HTML
Browser
HTML
JSON
3rd party API
3rd party API
3rd party API
3rd party API
3rd party API
3rd party API
It’s hard to create new APIs and customize them
Version control of the provided APIs
Monitor, manage, and monetize API usage
Manage authentication and access rights for APIs
Traffic management and protection of API endpoints
Infrastructure setup and management and maintenance
Amazon
API Gateway
Quickly create APIs with Amazon API Gateway
Multiple versions and stages
Create and distribute API keys
Use of AWS SigV4 on request
Request throttling and monitoring
AWS Lambda can be used as a backend
Traditional Architecture…
Internet
Mobile Apps
Websites
Services
AWS
ELB
サーバー管理が⼤変
キャッシュやスロットリングが⼤変
With Amazon API Gateway !!!
Internet
Mobile Apps
Websites
Services
API
Gateway
AWS Lambda
functions
AWS
API Gateway
Cache
Amazon
CloudWatch
Amazon
DynamoDB
Endpoints on
Amazon EC2 /
Amazon
Elastic
Beanstalk
Any other publicly
accessible endpoint
With Amazon API Gateway !!!
Internet
Mobile Apps
Websites
Services
API
Gateway
AWS Lambda
functions
AWS
API Gateway
Cache
Amazon
CloudWatch
Amazon
DynamoDB
Endpoints on
Amazon EC2 /
Amazon
Elastic
Beanstalk
Any other publicly
accessible endpoint
No need for servers (IaaS)
No installation
Easy operation and maintainance
Small start
Microservices
Case 1. Create API, retrieve data and display it on WP
JSON
HTML
Browser
DynamoDB
Table “Pets”
Lambda Function
“getPets”
API GW
/pets GET
REST API
Create API
Create Resource
Create “GET” Method
Lambda Function “getPets”
Program to retrieve items from the database (DynamoDB)
DynamoDB Table “Pets”
Insert an item into the database
API Endpoint
“GET” test by POSTMAN
wp_remote_get() retrieves data from the API
Display the data
No more "black screen" to create APIs !!!
BlackScreen
Case 2. Fetching data by JavaScript and displaying it on WP
JSON
HTML
Browser
JavaScript
DynamoDB
Table “Pets”
Lambda Function
“getPets”
API GW
/pets GET
REST API
JavaScript
Cross-Origin Request is Blocked !
Browser
DynamoDB
Table “Pets”
Lambda Function
“getPets”
API GW
/pets GET
A-site(Origin)
B-site
CORS
A-site : 許可
Enable CORS
When an API resource is requested from domains other than the API's own domain,
Cross-Origin Resource Sharing (CORS) needs to be enabled for the selected method of
the resource.
Display data by JavaScript
WordPress RESTful API & Amazon API Gateway (English version)
S3 EC2
CloudFront
API Gateway Lambda DynamoDB
StaticPress
REST API
Browser
JavaScript
Amazon API Gateway
Internet
Mobile Apps
Websites
Services
API
Gateway
AWS Lambda
functions
AWS
API Gateway
Cache
Amazon
CloudWatch
Amazon
DynamoDB
Endpoints on
Amazon EC2 /
Amazon
Elastic
Beanstalk
Any other publicly
accessible endpoint
Case 3. Create a new API by customizing an existing API
Custom API Origin API
Query String や
Request Header を変更
Status Code や
Response Header を変更
Stock API
Map API
Weather API
複数の API を集約
Custom API
HTTP Proxy
What’s WP REST API?
• Just install the plugin and you can provide a simple HTTP-based
REST API.
• Users, posts, taxonomy, and other data on a WordPress can be
retrieved and updated via simple HTTP requests.
http://v2.wp-api.org/ プラグインをインストール
for Mobile appʼs backend
REST API
JSON WP REST API
Frontend Backend
iOS
Android
Tablet
Fire
Android
iOS
Tablet
GET /wp-json/wp/v2/posts
When there’s not much access
WP REST API
GET /wp-json/wp/v2/posts
WP REST API
When there’s a lot of access
GET /wp-json/wp/v2/posts
Case 4. Control load with caching and throttling
API
Gateway
API Gateway
Cache
Amazon
CloudWatch
GET /wp-json/wp/v2/posts
WP REST API
Caching and Throttling
Summary
• Reduce the time and effort of building and operating
REST APIs
• Combination of WordPress and REST API
• Backend integration (PHP)
• Frontend integration (JavaScript)
• Aggregate APIs as HTTP Proxy
• Improve availability by caching and throttling WP REST API.
• Serverless WordPress !?!
Thank you !

More Related Content

PPTX
インセプションデッキのひな形(PPT形式:ダウンロード用)
PDF
アジャイル開発の現在・過去・未来~今を知り、源流を訪ね、先を見据える~
PPTX
グラフデータベース入門
PDF
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
PDF
ナレッジグラフ入門
PDF
ジャストシステムJava100本ノックのご紹介
PPTX
Agile開発でのテストのやり方~私の場合~
PDF
JVMパラメータチューニングにおけるOptunaの活用事例 ( Optuna Meetup #1 )
インセプションデッキのひな形(PPT形式:ダウンロード用)
アジャイル開発の現在・過去・未来~今を知り、源流を訪ね、先を見据える~
グラフデータベース入門
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
ナレッジグラフ入門
ジャストシステムJava100本ノックのご紹介
Agile開発でのテストのやり方~私の場合~
JVMパラメータチューニングにおけるOptunaの活用事例 ( Optuna Meetup #1 )

What's hot (20)

PDF
DI(依存性注入)について
PDF
【論文紹介】U-GAT-IT
PPTX
OpenAI FineTuning を試してみる
PDF
【メタサーベイ】Transformerから基盤モデルまでの流れ / From Transformer to Foundation Models
PDF
【メタサーベイ】基盤モデル / Foundation Models
PDF
フロー効率性とリソース効率性、再入門 #devlove #devkan
PPTX
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
PDF
SSII2022 [OS3-02] Federated Learningの基礎と応用
PDF
論文のいろは
PPTX
車両運行管理システムのためのデータ整備と機械学習の活用
PDF
JDLA主催「CVPR2023技術報告会」発表資料
PPTX
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
PDF
画像をテキストで検索したい!(OpenAI CLIP) - VRC-LT #15
PDF
Goodfellow先生おすすめのGAN論文6つを紹介
PDF
ナレッジグラフとオントロジー
PDF
フロー効率性とリソース効率性について #xpjug
PPTX
Spring Cloud Netflixを使おう #jsug
PDF
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
PPTX
[DLHacks]StyleGANとBigGANのStyle mixing, morphing
PDF
鷲崎 メトリクスの基礎とGQM法によるゴール指向の測定 2014年12月18日 日本科学技術連名SQiP研究会 演習コースI ソフトウェア工学の基礎
DI(依存性注入)について
【論文紹介】U-GAT-IT
OpenAI FineTuning を試してみる
【メタサーベイ】Transformerから基盤モデルまでの流れ / From Transformer to Foundation Models
【メタサーベイ】基盤モデル / Foundation Models
フロー効率性とリソース効率性、再入門 #devlove #devkan
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
SSII2022 [OS3-02] Federated Learningの基礎と応用
論文のいろは
車両運行管理システムのためのデータ整備と機械学習の活用
JDLA主催「CVPR2023技術報告会」発表資料
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
画像をテキストで検索したい!(OpenAI CLIP) - VRC-LT #15
Goodfellow先生おすすめのGAN論文6つを紹介
ナレッジグラフとオントロジー
フロー効率性とリソース効率性について #xpjug
Spring Cloud Netflixを使おう #jsug
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
[DLHacks]StyleGANとBigGANのStyle mixing, morphing
鷲崎 メトリクスの基礎とGQM法によるゴール指向の測定 2014年12月18日 日本科学技術連名SQiP研究会 演習コースI ソフトウェア工学の基礎
Ad

Similar to WordPress RESTful API & Amazon API Gateway (English version) (20)

PPTX
REST-API introduction for developers
PDF
WordPress RESTful API & Amazon API Gateway - WordCamp Kansai 2016
PPTX
Understanding APIs.pptx
PPTX
Understanding APIs.pptx introduction chk
PDF
API Basics
PDF
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
PDF
REST APIs, Girls Who Code
PDF
Introduction to REST - REST Basics - JSON
PPTX
Super simple introduction to REST-APIs (2nd version)
PDF
What is REST?
PPTX
rest-api-basics.pptx
PDF
REST API Basics
PPTX
Standards of rest api
PPTX
Jones "Working with Scholarly APIs: A NISO Training Series, Session One: Foun...
PPTX
A Deep Dive into RESTful API Design Part 2
PPTX
RESTful Services
PDF
REST API Recommendations
PDF
Modern REST API design principles and rules.pdf
PPTX
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
PPTX
Api crash
REST-API introduction for developers
WordPress RESTful API & Amazon API Gateway - WordCamp Kansai 2016
Understanding APIs.pptx
Understanding APIs.pptx introduction chk
API Basics
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
REST APIs, Girls Who Code
Introduction to REST - REST Basics - JSON
Super simple introduction to REST-APIs (2nd version)
What is REST?
rest-api-basics.pptx
REST API Basics
Standards of rest api
Jones "Working with Scholarly APIs: A NISO Training Series, Session One: Foun...
A Deep Dive into RESTful API Design Part 2
RESTful Services
REST API Recommendations
Modern REST API design principles and rules.pdf
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
Api crash
Ad

More from 崇之 清水 (20)

PDF
知らなきゃ損なアップデートを振り返り(2020年分)- いにしえのサービスから勝手にチョイス
PDF
マイクロサービスを AWS サーバレス&コンテナで実装する方法
PDF
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
PDF
クラウドを活用したセンシング/モニタリングなどデータ分析の実現
PDF
AWS 主要なサービスアップデート 6/3-11/28
PDF
5分でサーバーレスの環境構築から本番デプロイまでやったろやないか! - Serverless Meetup Osaka #4 LT
PDF
サーバレスアプリケーションの入門と実践 - AWS Cloud Roadshow 2017 Osaka
PDF
AWS における サーバーレスの基礎からチューニングまで
PDF
データ分析 on AWS
PDF
日本語でおk AI スピーカーを作ってみた
PDF
Amazon Web Services (AWS) のご紹介
PDF
Amazon AI のスゴいデモ(仮) - Serverless Meetup Osaka
PDF
Amazon Pinpoint - re:Invent Serverless Follow Up - 20161207
PDF
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
PDF
Amazon API Gateway を活用したゲームサーバー構築
PDF
関西スタートアップAWS勉強会 スタートアップ最新事例
PDF
スタートアップ向け構成例とAWS活用事例(福岡市スタートアップカフェ)
PDF
Amazon Aurora の活用 - Developers.IO in OSAKA
PDF
SA プライムなう! - AWS IoT とロボットアームでお絵かき
PDF
Amazon Aurora の活用
知らなきゃ損なアップデートを振り返り(2020年分)- いにしえのサービスから勝手にチョイス
マイクロサービスを AWS サーバレス&コンテナで実装する方法
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
クラウドを活用したセンシング/モニタリングなどデータ分析の実現
AWS 主要なサービスアップデート 6/3-11/28
5分でサーバーレスの環境構築から本番デプロイまでやったろやないか! - Serverless Meetup Osaka #4 LT
サーバレスアプリケーションの入門と実践 - AWS Cloud Roadshow 2017 Osaka
AWS における サーバーレスの基礎からチューニングまで
データ分析 on AWS
日本語でおk AI スピーカーを作ってみた
Amazon Web Services (AWS) のご紹介
Amazon AI のスゴいデモ(仮) - Serverless Meetup Osaka
Amazon Pinpoint - re:Invent Serverless Follow Up - 20161207
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
Amazon API Gateway を活用したゲームサーバー構築
関西スタートアップAWS勉強会 スタートアップ最新事例
スタートアップ向け構成例とAWS活用事例(福岡市スタートアップカフェ)
Amazon Aurora の活用 - Developers.IO in OSAKA
SA プライムなう! - AWS IoT とロボットアームでお絵かき
Amazon Aurora の活用

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
A Presentation on Artificial Intelligence
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25-Week II
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A Presentation on Artificial Intelligence
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Reach Out and Touch Someone: Haptics and Empathic Computing
Assigned Numbers - 2025 - Bluetooth® Document
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

WordPress RESTful API & Amazon API Gateway (English version)

  • 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Takayuki Shimizu @shimy_net Solutions Architect, Amazon Web Services Japan K.K. July 10, 2016 WordPress RESTful API & Amazon API Gateway WordCamp Kansai 2016 English version
  • 2. About Me • Takayuki Shimizu @shimy_net AWS Comedian • Funny presentations with useless technology • http://www.slideshare.net/shimy_net Kickstart EC2 KA-ME-HA-ME-HA by Kinesis Bike with DynamoDB Pythagora Switch Automation
  • 3. Drawing Robot with AWS IoT AWS IoT Browser Robot arm
  • 4. What to Expect from the Session 1. What’s REST API ? 2. Display external data on WordPress 3. Why Amazon API Gateway ? 4. Build Serverlss REST API 5. Patterns with WordPress 6. Summary
  • 5. • REpresentational State Transfer • Web architecture as proposed by Roy Fielding • APIs that follow the principles of REST are called RESTful What’s REST API ?
  • 6. Resources • “Resource” is any information that has a name. • Weather in Osaka • Today's News • Amazon's stock price • “Resource” is represented by a “URI” • URI indicates the Resource itself • URI and resource have a one-to-one relationship • ”State" can change with time and conditions, but its ”Meaning" will never change.
  • 7. URI • Uniform Resource Identifier • URI identifies the Resource • Example) https://api.example.com/resouces/1234 • Use only Nouns • Not actions • The basic rule is that there are no verbs in the URI path
  • 8. HTTP method • Select HTTP method to be used depending on what is to be processed with the resource indicated by the URI. • Use the methods defined in HTTP. • GET / POST / PUT / DELETE or PATCH are mainly used. HTTP method Meaning CRUD GET Get a resource READ POST Create a child resource CREATE PUT Update a resource (existing URI) Create a resource (new URI) UPDATE CREATE DELETE Delete a resource DELETE PATCH Partially update a resource UPDATE
  • 9. HTTP status code HTTP status code Meaning Example 200 OK The request has succeeded. Referencing resource information via GET 201 CREATED The request has succeeded and a new resource has been created as a result. Creating resources via POST 204 NO CONTENT There is no content to send for this request, but the headers may be useful. Delete resources via DELETE 400 BAD REQUEST The server could not understand the request due to invalid syntax. When you use a method that is not defined, or when the JSON format of the request body is wrong 401 UNAUTHORIZED This response means "unauthenticated". When a URL that requires authentication is accessed without authentication 403 FORBIDDEN The client does not have access rights to the content When you access a resource for which you do not have access rights 404 NOT FOUND The server can not find the requested resource. GET to a non-existent resource 409 CONFRICT This response is sent when a request conflicts with the current state of the server. When the data you are trying to create or update gives an error due to unique constraints, etc. 500 INTERNAL SERVER ERROR internal error in the server Server-side errors in general, including exceptions during processing
  • 10. Stateless • No state between client and server • (Ideally) every request should contain all the information necessary to process it • No state makes it easier to have scalability
  • 11. Stateful Hello Which side dishes would you like? French fries Which drink? Thatʼs all Coke Anything else? The check is 1000 yen Give me a burger combo
  • 12. Stateless Give me a burger combo Give me a burger combo with French fries Give me a burger combo with French fries and Coke Give me a burger combo with French fries and Coke Hello Which side dishes would you like? Which drink? Anything else? The check is 1000 yen
  • 13. API proliferation The number of published APIs is growing rapidly 2418 10302 0 2000 4000 6000 8000 10000 12000 Jun-05 Oct-05 Feb-06 Jun-06 Oct-06 Feb-07 Jun-07 Oct-07 Feb-08 Jun-08 Oct-08 Feb-09 Jun-09 Oct-09 Feb-10 Jun-10 Oct-10 Feb-11 Jun-11 Oct-11 Feb-12 Jun-12 Oct-12 Feb-13 Jun-13 Oct-13 * Data from ProgrammableWeb
  • 14. How to display external data on WordPress Weather information 3rd party API
  • 15. • Backend (wp_remote_get, wp_remote_post, etc.) • Frontend (Ajax with jQuery, Angular JS, React, etc.) How to embed external data JSON 3rd party API Browser HTML Browser 3rd party API HTML JSON
  • 16. • Backend (wp_remote_get, wp_remote_post, etc.) • Frontend (Ajax with jQuery, Angular JS, React, etc.) There is no convenient 3rd party API... JSON Browser HTML Browser HTML JSON 3rd party API 3rd party API 3rd party API 3rd party API 3rd party API 3rd party API
  • 17. It’s hard to create new APIs and customize them Version control of the provided APIs Monitor, manage, and monetize API usage Manage authentication and access rights for APIs Traffic management and protection of API endpoints Infrastructure setup and management and maintenance
  • 19. Quickly create APIs with Amazon API Gateway Multiple versions and stages Create and distribute API keys Use of AWS SigV4 on request Request throttling and monitoring AWS Lambda can be used as a backend
  • 21. With Amazon API Gateway !!! Internet Mobile Apps Websites Services API Gateway AWS Lambda functions AWS API Gateway Cache Amazon CloudWatch Amazon DynamoDB Endpoints on Amazon EC2 / Amazon Elastic Beanstalk Any other publicly accessible endpoint
  • 22. With Amazon API Gateway !!! Internet Mobile Apps Websites Services API Gateway AWS Lambda functions AWS API Gateway Cache Amazon CloudWatch Amazon DynamoDB Endpoints on Amazon EC2 / Amazon Elastic Beanstalk Any other publicly accessible endpoint
  • 23. No need for servers (IaaS) No installation Easy operation and maintainance Small start Microservices
  • 24. Case 1. Create API, retrieve data and display it on WP JSON HTML Browser DynamoDB Table “Pets” Lambda Function “getPets” API GW /pets GET REST API
  • 28. Lambda Function “getPets” Program to retrieve items from the database (DynamoDB)
  • 29. DynamoDB Table “Pets” Insert an item into the database
  • 33. No more "black screen" to create APIs !!! BlackScreen
  • 34. Case 2. Fetching data by JavaScript and displaying it on WP JSON HTML Browser JavaScript DynamoDB Table “Pets” Lambda Function “getPets” API GW /pets GET REST API
  • 36. Cross-Origin Request is Blocked ! Browser DynamoDB Table “Pets” Lambda Function “getPets” API GW /pets GET A-site(Origin) B-site CORS A-site : 許可
  • 37. Enable CORS When an API resource is requested from domains other than the API's own domain, Cross-Origin Resource Sharing (CORS) needs to be enabled for the selected method of the resource.
  • 38. Display data by JavaScript
  • 40. S3 EC2 CloudFront API Gateway Lambda DynamoDB StaticPress REST API Browser JavaScript
  • 41. Amazon API Gateway Internet Mobile Apps Websites Services API Gateway AWS Lambda functions AWS API Gateway Cache Amazon CloudWatch Amazon DynamoDB Endpoints on Amazon EC2 / Amazon Elastic Beanstalk Any other publicly accessible endpoint
  • 42. Case 3. Create a new API by customizing an existing API Custom API Origin API Query String や Request Header を変更 Status Code や Response Header を変更 Stock API Map API Weather API 複数の API を集約 Custom API
  • 44. What’s WP REST API? • Just install the plugin and you can provide a simple HTTP-based REST API. • Users, posts, taxonomy, and other data on a WordPress can be retrieved and updated via simple HTTP requests. http://v2.wp-api.org/ プラグインをインストール
  • 45. for Mobile appʼs backend REST API JSON WP REST API Frontend Backend iOS Android Tablet Fire Android iOS Tablet
  • 47. When there’s not much access WP REST API GET /wp-json/wp/v2/posts
  • 48. WP REST API When there’s a lot of access GET /wp-json/wp/v2/posts
  • 49. Case 4. Control load with caching and throttling API Gateway API Gateway Cache Amazon CloudWatch GET /wp-json/wp/v2/posts WP REST API
  • 51. Summary • Reduce the time and effort of building and operating REST APIs • Combination of WordPress and REST API • Backend integration (PHP) • Frontend integration (JavaScript) • Aggregate APIs as HTTP Proxy • Improve availability by caching and throttling WP REST API. • Serverless WordPress !?!