SlideShare uma empresa Scribd logo
1 de 63
Baixar para ler offline
@dragonmantank
Dead Simple APIs with OpenAPI
@dragonmantank
What is OpenAPI?
@dragonmantank
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.3
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.3
@dragonmantank
Why OpenAPI?
@dragonmantank
Documentation Generation
@dragonmantank
Description as Code
@dragonmantank
@dragonmantank
Tooling Integrations
https://openapi.tools/
@dragonmantank https://github.com/Nexmo/nexmo-oas-renderer
@dragonmantank
Designing APIs
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.312
@dragonmantank
(It's a specification)
● Information about
the API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.313
@dragonmantank
openapi: 3.0.0
info:
version: 1.2.5
title: Voice API
description: "The Voice API [...]"
contact:
name: Nexmo DevRel
email: devrel@nexmo.com
url: "https://developer.nexmo.com"
servers:
- url: https://api.nexmo.com/v1/calls
Information Header
http://spec.openapis.org/oas/v3.0.3#openapi-object
@dragonmantank
openapi: 3.0.0
info:
version: 1.2.5
title: Voice API
description: "The Voice API [...]"
contact:
name: Nexmo DevRel
email: devrel@nexmo.com
url:
"https://developer.nexmo.com"
servers:
- url: https://api.nexmo.com/v1/calls
Information Header
http://spec.openapis.org/oas/v3.0.3#openapi-object
@dragonmantank
openapi: 3.0.0
info:
version: 1.2.5
title: Voice API
description: "The Voice API [...]"
contact:
name: Nexmo DevRel
email: devrel@nexmo.com
url: "https://developer.nexmo.com"
servers:
- url: https://api.nexmo.com/v1/calls
Information Header
http://spec.openapis.org/oas/v3.0.3#openapi-object
@dragonmantank
openapi: 3.0.0
info:
version: 1.2.5
title: Voice API
description: "The Voice API [...]"
contact:
name: Nexmo DevRel
email: devrel@nexmo.com
url:
"https://developer.nexmo.com"
servers:
- url: https://api.nexmo.com/v1/calls
Information Header
http://spec.openapis.org/oas/v3.0.3#openapi-object
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints
that are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.318
@dragonmantank
[Information Header]
paths:
"/":
"/{uuid}":
"/{uuid}/stream":
"/{uuid}/talk":
"/{uuid}/dtmf":
Path Information
http://spec.openapis.org/oas/v3.0.3#paths-object
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.320
@dragonmantank
[Information Header]
paths:
"/":
post:
get:
[...]
Request Structure
http://spec.openapis.org/oas/v3.0.3#path-item-object
@dragonmantank
[Information Header]
paths:
"/":
get:
summary: Get details of your calls
description: Get details [...]
operationId: getCalls
parameters:
- name: status
in: query
description: Filter calls [...]
schema:
type: string
example: started
post:
[...]
[...]
Request Structure
http://spec.openapis.org/oas/v3.0.3#operation-object
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.323
@dragonmantank
[Information Header]
paths:
"/":
get:
[...]
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
count:
type: integer
post:
[...]
[...]
Response Structure
http://spec.openapis.org/oas/v3.0.3#response-object
@dragonmantank
[Information Header]
paths:
"/":
get:
[...]
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
count:
type: integer
post:
[...]
[...]
Response Structure
http://spec.openapis.org/oas/v3.0.3#response-object
@dragonmantank
[Information Header]
paths:
"/":
get:
[...]
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
count:
type: integer
post:
[...]
[...]
Response Structure
http://spec.openapis.org/oas/v3.0.3#response-object
@dragonmantank
responses:
'200':
$ref: '#/components/responses/ConversationLite'
Response Structure
http://spec.openapis.org/oas/v3.0.3#reference-object
@dragonmantank
[Information Header]
[Path Information]
components:
responses:
ConversationLite:
content:
application/json:
schema:
type: object
properties:
id:
$ref: '#/components/[...]'
href:
$ref: '#/components/[...]'
Response Structure
http://spec.openapis.org/oas/v3.0.3#reference-object
@dragonmantank
(It's a specification)
● Information about the
API
● Define endpoints that
are available
● What requests look
like
● What responses look
like
● Authentication
Methods
http://spec.openapis.org/oas/v3.0.329
@dragonmantank
[Information Header]
paths:
"/":
get:
security:
- bearerAuth: []
summary: Get details of your calls
description: Get details [...]
operationId: getCalls
parameters:
- name: status
in: query
description: Filter calls [...]
schema:
type: string
example: started
post:
[...]
[...]
Request Structure
http://spec.openapis.org/oas/v3.0.3#security-scheme-object
@dragonmantank
[Information Header]
paths:
"/":
get:
security:
- bearerAuth: []
summary: Get details of your
calls
description: Get details [...]
operationId: getCalls
parameters:
- name: status
in: query
description: Filter calls [...]
schema:
type: string
example: started
post:
[...]
[...]
Request Structure
http://spec.openapis.org/oas/v3.0.3#security-scheme-object
@dragonmantank https://stoplight.io/studio/
@dragonmantank https://stoplight.io/studio/
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank
Prototyping and Mocking APIs
@dragonmantank https://stoplight.io/open-source/prism/
@dragonmantank https://stoplight.io/open-source/prism/
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank https://www.postman.com/
@dragonmantank https://www.postman.com/collection
@dragonmantank
Generating API Code
https://github.com/OpenAPITools/openapi-generator
@dragonmantank
● ASP.Net
● C++
● Golang
● Java
● PHP
● NodeJS Express
● Ruby on Rails
https://openapi-generator.tech/docs/generators
@dragonmantank
$ openapi-generator-cli 
generate 
-i Voice.v1.yaml 
-g php-slim4 
-o $(pwd)/server
@dragonmantank
@dragonmantank
$ openapi-generator-cli 
generate 
-i Voice.v1.yaml 
-g php-laravel 
-o $(pwd)/server
@dragonmantank
@dragonmantank
@dragonmantank
● ASP.Net
● C++
● Golang
● Java
● PHP
● NodeJS
● Ruby
https://openapi-generator.tech/docs/generators
@dragonmantank
$ openapi-generator-cli 
generate 
-i Voice.v1.yaml 
-g php 
-o $(pwd)/sdk
@dragonmantank
@dragonmantank
@dragonmantank
● Document your
API
● Test your API
● Fast-track your
development
59
@dragonmantank
● Document your
API
● Test your API
● Fast-track your
development
60
@dragonmantank
● Document your
API
● Test your API
● Fast-track your
development
61
@dragonmantank
● Document your
API
● Test your API
● Fast-track your
development
62
@dragonmantank
Chris Tankersley
Developer Advocate at
Nexmo/Vonage
@dragonmantank
chris@ctankersley.com

Mais conteúdo relacionado

Semelhante a Dead Simple APIs with OpenAPI

jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
Kiril Iliev
 

Semelhante a Dead Simple APIs with OpenAPI (20)

KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!
 
Developing Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & PythonDeveloping Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & Python
 
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeonapidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
 
Austin Day of Rest - Introduction
Austin Day of Rest - IntroductionAustin Day of Rest - Introduction
Austin Day of Rest - Introduction
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
Araport Workshop Tutorial 2: Authentication and the Agave Profiles Service
Araport Workshop Tutorial 2: Authentication and the Agave Profiles ServiceAraport Workshop Tutorial 2: Authentication and the Agave Profiles Service
Araport Workshop Tutorial 2: Authentication and the Agave Profiles Service
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
 
"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, Temboo"Managing API Complexity". Matthew Flaming, Temboo
"Managing API Complexity". Matthew Flaming, Temboo
 
aip-workshop1-dev-tutorial
aip-workshop1-dev-tutorialaip-workshop1-dev-tutorial
aip-workshop1-dev-tutorial
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
#startathon2.0 - Spark Core
#startathon2.0 - Spark Core#startathon2.0 - Spark Core
#startathon2.0 - Spark Core
 
FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBFOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
 
Test-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) serviceTest-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
 
Diseño y Desarrollo de APIs
Diseño y Desarrollo de APIsDiseño y Desarrollo de APIs
Diseño y Desarrollo de APIs
 
About Clack
About ClackAbout Clack
About Clack
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 

Mais de Chris Tankersley

Mais de Chris Tankersley (20)

Docker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersDocker is Dead: Long Live Containers
Docker is Dead: Long Live Containers
 
Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with git
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
You Got Async in my PHP!
You Got Async in my PHP!You Got Async in my PHP!
You Got Async in my PHP!
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
They are Watching You
They are Watching YouThey are Watching You
They are Watching You
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About Optimization
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open Source
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 

Último

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Dead Simple APIs with OpenAPI