SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Building APIs
with the OpenAPI Spec
Dr. Pedro J. Molina
CEO at Metadev @pmolinam
MAD · NOV 24-25 · 2017
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
What’s common here?
Library 1
Library 2
Shop N
Service 1
Service 2
Service N
mLab
SendGrid
Plugin N
API
API
API
Ecosystems
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Pedro J. Molina
@pmolinam
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Agenda
 API Economy
 OpenAPI
 User Cases
 Versioning
 Future
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Application Programmer Interface
Services ready for 3er parties to
consume
Technical Description (dev. oriented)
Promotes system integration by
clear contracts durable in time
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API Economy
APIs define plataforms.
Twitter, Twilio, Google Maps as API samples.
You can’t win without an ecosystem.
You can’t have an ecosystem without an API.
First one take it all  market share
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API
API as a contract with customers
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Language agnostic APIs
1. CORBA >> C + IDL
2. SOA >> XML + SOAP + WDSL …
3. REST >> JSON + HTTP
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
OpenAPI Initiative
 De facto standard (previously: Swagger)
 Linux Foundation https://www.openapis.org
 Formal contract description for a REST API useful for both
humans and machines.
 Contract described in JSON or YAML
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
OpenAPI Initiative
Tooling
 Editor http://editor.swagger.io
 API Explorer http://petstore.swagger.io
 Validator
https://online.swagger.io/validator
Opensource Generators:
 skeletons for back-ends
 proxies for front-end
http://swagger.io/swagger-codegen
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Use cases
1. Legacy API
2. Contract First
3. Service driven
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
1. Legacy API
Document an existing API
Contract creation http://editor.swagger.io
Validation
Results:
 API docs
 SDK generation for clients
API
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
1. Legacy API. Sample
Is Nieves a girl’s or boy’s name?
Web service to discover it:
http://www.jerolba.com/mujeres-y-hombres-y-serverless
GET https://us-central1-hombre-o-mujer.cloudfunctions.net/gender?name=nieves
Credits to: Jerónimo López @jerolba
API
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
swagger: '2.0'
info:
version: "1.0.0"
title: Girl or boy.
host: us-central1-hombre-o-mujer.cloudfunctions.net
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: Gender
description: Frequency name based API to guest gender.
1. Legacy API. Contract
API
http://bit.ly/gender-swagger
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
paths:
/gender:
get:
description: |
Returns the probability base on gender frequency on registed names in Spain.
parameters:
- name: name
in: query
description: Given name
required: true
type: string
responses:
# Response code
200:
description: Sucessful response
schema:
$ref: "#/definitions/GenderResponse"
404:
description: Not found
schema:
$ref: "#/definitions/GenderNotFoundResponse"
1. Legacy API. Contract
API
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
totalMale:
type: number
format: int32
totalFemale:
type: number
format: int32
GenderNotFoundResponse:
required:
- name
- gender
properties:
name:
type: string
gender:
type: string
definitions:
GenderResponse:
required:
- name
- gender
- probability
- totalMale
- totalFemale
properties:
name:
type: string
gender:
type: string
probability:
type: number
format: float
1. Legacy API. Contract
API
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
2. Contract First
Spec is written in first place
http://editor.swagger.io
Can generate:
 a skeleton for backend
 a proxy or SDK for consumers
 enables parallel work on backend and frontend teams.
 contract change can be versioned in a proper way.
API Client
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
2. Contract First. Available server stacks
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
2. Contract First. Available front-end stacks
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Swagger/code-gen
Migrating from spec v.2 to v.3
Book about how to extend swagger/code-gen for your
language/stack:
http://bit.ly/codegen101
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
3. Service Driven
 The Service defines the contract
 The OpenAPI spec is generated by a library using reflection over the
service.
 Requires taking special care to NOT TO break the API compatibility.
 Sample: https://openapi3.herokuapp.com
 Source: https://github.com/pjmolina/event-backend
API Client
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Resources
Maintainer of:
 baucis-swagger2 Generates v.2 contracts for Baucis backends
 https://www.npmjs.com/package/baucis-swagger2
 baucis-openapi3 Generates v.3 contracts for Baucis backends
 https://www.npmjs.com/package/baucis-openapi3
 openapi3-ts TypeScript library for building OpenAPI3 documents
 https://www.npmjs.com/package/openapi3-ts
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API Management Tools
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API Management Tools
Examples
3scale
Apigee
Mashape Kong
CA 7Layers
Azure API Management
IBM Bluemix API
Management
WSO
 Provides an extra layer in front of your API
 Managed by 3er parties (externalized)
Main features:
 Authentication, Authorization
 Role-based security
 DOS attack protection
 Monetization: pay per use
 Scaling
 Auditing
 Usage metrics, analytics
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API Versioning
 Versioning via URL
Versioning via parameter
Versioning via headers
GET /v1/restaurants?location=SVQ
GET /v2/restaurants?location=SVQ&limit=30
GET /restaurants?location=SVQ&limit=30&v=2
GET /restaurants?location=SVQ&limit=30
Version: 2
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
API Scalability
 Stateless API
 Load-balancer to handle traffic
(e.g. nginx or ha-proxy)
 Distributes traffic to your API
servers
 DNS, SSL and certs. configured in
the load balancer
api
lb api
api
#0
#1
#2
443
80
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Summing up
 OpenAPI is a de-facto standard to manage
APIs
 Simplifies consumption and API integration
 Version 3.0 released in June 2017
Roadmap:
 Swagger-codegen porting from v.2 to v.3
(work in progress)
 Convergence with Google gRPC
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Questions?
@pmolinam
1 Q = 1 sticker
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Thx!
@pmolinam
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
Extra bonus
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
REST
 REpresentational State Transfer
 Stateless Protocol
 Unique URIs per resource
 Semantic attached to operations/verbs
 GET/PUT/POST/DELETE over HTTP
Hypermedia (navigable)
GET /actors/42
Accept: application/json
200 OK
Content-Type: application/json
{ "id": 42
"name": "Jessica"
"lastname": "Alba"
"filmography": "/films/42"
}
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
MIME Types
 Declares encoding
Most frequents are:
 JSON application/json
 XML text/xml
 HTML text/html
 Plain text text/plain
 CSV text/csv
GET /actors/42
Accept: text/xml
200 OK
Content-Type: text/xml
<actor id="42">
<name>Jessica</name>
<lastname>Alba</lastname>
<filmography
url= "/films/42" />
</actor>
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
REST Levels
Richarson Maturity Model
http://martinfowler.com/articles/richardsonMaturityModel.html
Level 0. HTTP and nothing else (RPC under HTTP)
Level 1. Resources GET /invoice/217
Level 2. Using the semantinc of verbs and HTTP error codes POST /invoice/  201 Created
https://i.stack.imgur.com/whhD1.png
https://httpstatuses.com
Level 3. Hypermedia Controls <link rel=“lines”
uri=“/factura/217/lineas”/>
Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
HAL
{
“id”: 1234
“name”: “Alice in Wonderland”
“_links”: {
“self”: { “href”: “/book/10”},
“prev”: { “href”: “/book/9”},
“next”: { “href”: “/book/11”},
“action-delete”: {
“verb”: “DELETE”,
“href”: “/book/10”
}
}
}
://

Contenu connexe

Tendances

Richardson Maturity and OpenAPI 3.0
Richardson Maturity and OpenAPI 3.0Richardson Maturity and OpenAPI 3.0
Richardson Maturity and OpenAPI 3.0SmartBear
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for TestersPostman
 
API Test Automation
API Test Automation API Test Automation
API Test Automation SQALab
 
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0WSO2
 
OpenAPI development with Python
OpenAPI development with PythonOpenAPI development with Python
OpenAPI development with PythonTakuro Wada
 
OpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerOpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerSmartBear
 
API-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approachAPI-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approachSven Bernhardt
 
Azure API Management
Azure API ManagementAzure API Management
Azure API ManagementDaniel Toomey
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak Abhishek Koserwal
 
Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing SwaggerTony Tam
 
What is an API Gateway?
What is an API Gateway?What is an API Gateway?
What is an API Gateway?LunchBadger
 
Introduction to API
Introduction to APIIntroduction to API
Introduction to APIrajnishjha29
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to SwaggerKnoldus Inc.
 

Tendances (20)

API
APIAPI
API
 
Richardson Maturity and OpenAPI 3.0
Richardson Maturity and OpenAPI 3.0Richardson Maturity and OpenAPI 3.0
Richardson Maturity and OpenAPI 3.0
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
API Test Automation
API Test Automation API Test Automation
API Test Automation
 
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0
The Best of Both Worlds: Introducing WSO2 API Manager 4.0.0
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
What is an API
What is an APIWhat is an API
What is an API
 
OpenAPI development with Python
OpenAPI development with PythonOpenAPI development with Python
OpenAPI development with Python
 
OpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerOpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of Swagger
 
What's an api
What's an apiWhat's an api
What's an api
 
API-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approachAPI-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approach
 
Azure API Management
Azure API ManagementAzure API Management
Azure API Management
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 
Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing Swagger
 
What is an API Gateway?
What is an API Gateway?What is an API Gateway?
What is an API Gateway?
 
API Governance in the Enterprise
API Governance in the EnterpriseAPI Governance in the Enterprise
API Governance in the Enterprise
 
Introduction to API
Introduction to APIIntroduction to API
Introduction to API
 
Definitive Guide to API Management
Definitive Guide to API ManagementDefinitive Guide to API Management
Definitive Guide to API Management
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 

Similaire à Building APIs with the OpenApi Spec

OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfPostman
 
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIsWSO2
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract TestingPostman
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
INTERFACE, by apidays - How to Win Friends and Influence People with API First
INTERFACE, by apidays - How to Win Friends and Influence People with API FirstINTERFACE, by apidays - How to Win Friends and Influence People with API First
INTERFACE, by apidays - How to Win Friends and Influence People with API Firstapidays
 
Building an API Factory: Turn your APIs into Products
Building an API Factory: Turn your APIs into ProductsBuilding an API Factory: Turn your APIs into Products
Building an API Factory: Turn your APIs into ProductsNuwan Dias
 
Google Cloud Platform Solutions for DevOps Engineers
Google Cloud Platform Solutions  for DevOps EngineersGoogle Cloud Platform Solutions  for DevOps Engineers
Google Cloud Platform Solutions for DevOps EngineersMárton Kodok
 
Enterprise E-Commerce Webinar #3: Bringing Your API to Market
Enterprise E-Commerce Webinar #3: Bringing Your API to MarketEnterprise E-Commerce Webinar #3: Bringing Your API to Market
Enterprise E-Commerce Webinar #3: Bringing Your API to MarketNikita Sharma
 
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...apidays
 
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...Jitendra Bafna
 
How_to_create_modular_microservice_test_projects.pdf
How_to_create_modular_microservice_test_projects.pdfHow_to_create_modular_microservice_test_projects.pdf
How_to_create_modular_microservice_test_projects.pdfskimorod
 
Scale a Swagger based Web API (Guillaume Laforge)
Scale a Swagger based Web API (Guillaume Laforge)Scale a Swagger based Web API (Guillaume Laforge)
Scale a Swagger based Web API (Guillaume Laforge)Nordic APIs
 
The Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfThe Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfConcetto Labs
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...Restlet
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...apidays
 
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...apidays
 
INTERFACE, by apidays - The 8 Key Components of a Modern API Stack by Iddo G...
INTERFACE, by apidays  - The 8 Key Components of a Modern API Stack by Iddo G...INTERFACE, by apidays  - The 8 Key Components of a Modern API Stack by Iddo G...
INTERFACE, by apidays - The 8 Key Components of a Modern API Stack by Iddo G...apidays
 
Pivotal + Apigee Workshop (June 4th, 2019)
Pivotal + Apigee Workshop (June 4th, 2019)Pivotal + Apigee Workshop (June 4th, 2019)
Pivotal + Apigee Workshop (June 4th, 2019)Alexandre Roman
 
A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019Bill Doerrfeld
 

Similaire à Building APIs with the OpenApi Spec (20)

OpenAPI Intro (1).pdf
OpenAPI Intro (1).pdfOpenAPI Intro (1).pdf
OpenAPI Intro (1).pdf
 
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
[WSO2 Integration Summit Bern 2019] Transforming Your Business through APIs
 
Space Camp - API Contract Testing
Space Camp - API Contract TestingSpace Camp - API Contract Testing
Space Camp - API Contract Testing
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
INTERFACE, by apidays - How to Win Friends and Influence People with API First
INTERFACE, by apidays - How to Win Friends and Influence People with API FirstINTERFACE, by apidays - How to Win Friends and Influence People with API First
INTERFACE, by apidays - How to Win Friends and Influence People with API First
 
Building an API Factory: Turn your APIs into Products
Building an API Factory: Turn your APIs into ProductsBuilding an API Factory: Turn your APIs into Products
Building an API Factory: Turn your APIs into Products
 
Google Cloud Platform Solutions for DevOps Engineers
Google Cloud Platform Solutions  for DevOps EngineersGoogle Cloud Platform Solutions  for DevOps Engineers
Google Cloud Platform Solutions for DevOps Engineers
 
Enterprise E-Commerce Webinar #3: Bringing Your API to Market
Enterprise E-Commerce Webinar #3: Bringing Your API to MarketEnterprise E-Commerce Webinar #3: Bringing Your API to Market
Enterprise E-Commerce Webinar #3: Bringing Your API to Market
 
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...
apidays LIVE Helsinki & North 2022_How to Win Friends and Influence People wi...
 
SVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApiSVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApi
 
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...
MuleSoft Surat Virtual Meetup#38 - Deep Dive into Anypoint API Proxy Options ...
 
How_to_create_modular_microservice_test_projects.pdf
How_to_create_modular_microservice_test_projects.pdfHow_to_create_modular_microservice_test_projects.pdf
How_to_create_modular_microservice_test_projects.pdf
 
Scale a Swagger based Web API (Guillaume Laforge)
Scale a Swagger based Web API (Guillaume Laforge)Scale a Swagger based Web API (Guillaume Laforge)
Scale a Swagger based Web API (Guillaume Laforge)
 
The Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdfThe Complete Guide to API Development in 2022.pdf
The Complete Guide to API Development in 2022.pdf
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...
apidays LIVE Paris 2021 - APIGEE, different ways for integrating with CI/CD p...
 
INTERFACE, by apidays - The 8 Key Components of a Modern API Stack by Iddo G...
INTERFACE, by apidays  - The 8 Key Components of a Modern API Stack by Iddo G...INTERFACE, by apidays  - The 8 Key Components of a Modern API Stack by Iddo G...
INTERFACE, by apidays - The 8 Key Components of a Modern API Stack by Iddo G...
 
Pivotal + Apigee Workshop (June 4th, 2019)
Pivotal + Apigee Workshop (June 4th, 2019)Pivotal + Apigee Workshop (June 4th, 2019)
Pivotal + Apigee Workshop (June 4th, 2019)
 
A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019
 

Plus de Pedro J. Molina

dotnetMalaga-2020 Gestión de la configuración en aplicaciones Web
dotnetMalaga-2020 Gestión de la configuración en aplicaciones WebdotnetMalaga-2020 Gestión de la configuración en aplicaciones Web
dotnetMalaga-2020 Gestión de la configuración en aplicaciones WebPedro J. Molina
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformPedro J. Molina
 
LangDev 2022 Metamodeling on the Web with Essential
LangDev 2022 Metamodeling on the Web with EssentialLangDev 2022 Metamodeling on the Web with Essential
LangDev 2022 Metamodeling on the Web with EssentialPedro J. Molina
 
Essential as the base for Web DSLs
Essential as the base for Web DSLsEssential as the base for Web DSLs
Essential as the base for Web DSLsPedro J. Molina
 
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. MolinaACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. MolinaPedro J. Molina
 
Esencia de Web Components
Esencia de Web ComponentsEsencia de Web Components
Esencia de Web ComponentsPedro J. Molina
 
Esencia de web components
Esencia de web componentsEsencia de web components
Esencia de web componentsPedro J. Molina
 
Securizando por construcción mediante MDE
Securizando por construcción mediante MDESecurizando por construcción mediante MDE
Securizando por construcción mediante MDEPedro J. Molina
 
Micro vs Nano (servicios)
Micro vs Nano (servicios)Micro vs Nano (servicios)
Micro vs Nano (servicios)Pedro J. Molina
 
Diseño de APIs con OpenAPI
Diseño de APIs con OpenAPIDiseño de APIs con OpenAPI
Diseño de APIs con OpenAPIPedro J. Molina
 
SVQDC 2017 Tecnologías para Microservicios
SVQDC 2017 Tecnologías para MicroserviciosSVQDC 2017 Tecnologías para Microservicios
SVQDC 2017 Tecnologías para MicroserviciosPedro J. Molina
 
Tecnologías para microservicios
Tecnologías para microserviciosTecnologías para microservicios
Tecnologías para microserviciosPedro J. Molina
 
Opensouthcode: Microservicios sobre MEAN Stack
Opensouthcode: Microservicios sobre MEAN StackOpensouthcode: Microservicios sobre MEAN Stack
Opensouthcode: Microservicios sobre MEAN StackPedro J. Molina
 

Plus de Pedro J. Molina (20)

MDE en la industria
MDE en la industriaMDE en la industria
MDE en la industria
 
Terraform
TerraformTerraform
Terraform
 
dotnetMalaga-2020 Gestión de la configuración en aplicaciones Web
dotnetMalaga-2020 Gestión de la configuración en aplicaciones WebdotnetMalaga-2020 Gestión de la configuración en aplicaciones Web
dotnetMalaga-2020 Gestión de la configuración en aplicaciones Web
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
LangDev 2022 Metamodeling on the Web with Essential
LangDev 2022 Metamodeling on the Web with EssentialLangDev 2022 Metamodeling on the Web with Essential
LangDev 2022 Metamodeling on the Web with Essential
 
Are Startups for me?
Are Startups for me?Are Startups for me?
Are Startups for me?
 
Meow Demo
Meow DemoMeow Demo
Meow Demo
 
Essential as the base for Web DSLs
Essential as the base for Web DSLsEssential as the base for Web DSLs
Essential as the base for Web DSLs
 
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. MolinaACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
ACM SIGCHI EICS-2019 Keynote. Quid, Pedro J. Molina
 
Esencia de Web Components
Esencia de Web ComponentsEsencia de Web Components
Esencia de Web Components
 
Esencia de web components
Esencia de web componentsEsencia de web components
Esencia de web components
 
OpenAPI 3.0.2
OpenAPI 3.0.2OpenAPI 3.0.2
OpenAPI 3.0.2
 
Quid
QuidQuid
Quid
 
Securizando por construcción mediante MDE
Securizando por construcción mediante MDESecurizando por construcción mediante MDE
Securizando por construcción mediante MDE
 
Micro vs Nano (servicios)
Micro vs Nano (servicios)Micro vs Nano (servicios)
Micro vs Nano (servicios)
 
Diseño de APIs con OpenAPI
Diseño de APIs con OpenAPIDiseño de APIs con OpenAPI
Diseño de APIs con OpenAPI
 
SVQDC 2017 Tecnologías para Microservicios
SVQDC 2017 Tecnologías para MicroserviciosSVQDC 2017 Tecnologías para Microservicios
SVQDC 2017 Tecnologías para Microservicios
 
Introducción a Angular
Introducción a AngularIntroducción a Angular
Introducción a Angular
 
Tecnologías para microservicios
Tecnologías para microserviciosTecnologías para microservicios
Tecnologías para microservicios
 
Opensouthcode: Microservicios sobre MEAN Stack
Opensouthcode: Microservicios sobre MEAN StackOpensouthcode: Microservicios sobre MEAN Stack
Opensouthcode: Microservicios sobre MEAN Stack
 

Dernier

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 FresherRemote DBA Services
 
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 Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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 SavingEdi Saputra
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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...DianaGray10
 
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].pdfOverkill Security
 
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 WoodJuan lago vázquez
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Dernier (20)

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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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...
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

Building APIs with the OpenApi Spec

  • 1. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Building APIs with the OpenAPI Spec Dr. Pedro J. Molina CEO at Metadev @pmolinam MAD · NOV 24-25 · 2017
  • 2. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam What’s common here? Library 1 Library 2 Shop N Service 1 Service 2 Service N mLab SendGrid Plugin N API API API Ecosystems
  • 3. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Pedro J. Molina @pmolinam
  • 4. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Agenda  API Economy  OpenAPI  User Cases  Versioning  Future
  • 5. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Application Programmer Interface Services ready for 3er parties to consume Technical Description (dev. oriented) Promotes system integration by clear contracts durable in time
  • 6. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API Economy APIs define plataforms. Twitter, Twilio, Google Maps as API samples. You can’t win without an ecosystem. You can’t have an ecosystem without an API. First one take it all  market share
  • 7. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API API as a contract with customers
  • 8. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Language agnostic APIs 1. CORBA >> C + IDL 2. SOA >> XML + SOAP + WDSL … 3. REST >> JSON + HTTP
  • 9. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam OpenAPI Initiative  De facto standard (previously: Swagger)  Linux Foundation https://www.openapis.org  Formal contract description for a REST API useful for both humans and machines.  Contract described in JSON or YAML
  • 10. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
  • 11. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam OpenAPI Initiative Tooling  Editor http://editor.swagger.io  API Explorer http://petstore.swagger.io  Validator https://online.swagger.io/validator Opensource Generators:  skeletons for back-ends  proxies for front-end http://swagger.io/swagger-codegen
  • 12. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Use cases 1. Legacy API 2. Contract First 3. Service driven
  • 13. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 1. Legacy API Document an existing API Contract creation http://editor.swagger.io Validation Results:  API docs  SDK generation for clients API
  • 14. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 1. Legacy API. Sample Is Nieves a girl’s or boy’s name? Web service to discover it: http://www.jerolba.com/mujeres-y-hombres-y-serverless GET https://us-central1-hombre-o-mujer.cloudfunctions.net/gender?name=nieves Credits to: Jerónimo López @jerolba API
  • 15. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam swagger: '2.0' info: version: "1.0.0" title: Girl or boy. host: us-central1-hombre-o-mujer.cloudfunctions.net schemes: - https consumes: - application/json produces: - application/json tags: - name: Gender description: Frequency name based API to guest gender. 1. Legacy API. Contract API http://bit.ly/gender-swagger
  • 16. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam paths: /gender: get: description: | Returns the probability base on gender frequency on registed names in Spain. parameters: - name: name in: query description: Given name required: true type: string responses: # Response code 200: description: Sucessful response schema: $ref: "#/definitions/GenderResponse" 404: description: Not found schema: $ref: "#/definitions/GenderNotFoundResponse" 1. Legacy API. Contract API
  • 17. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam totalMale: type: number format: int32 totalFemale: type: number format: int32 GenderNotFoundResponse: required: - name - gender properties: name: type: string gender: type: string definitions: GenderResponse: required: - name - gender - probability - totalMale - totalFemale properties: name: type: string gender: type: string probability: type: number format: float 1. Legacy API. Contract API
  • 18. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 2. Contract First Spec is written in first place http://editor.swagger.io Can generate:  a skeleton for backend  a proxy or SDK for consumers  enables parallel work on backend and frontend teams.  contract change can be versioned in a proper way. API Client
  • 19. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 2. Contract First. Available server stacks
  • 20. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 2. Contract First. Available front-end stacks
  • 21. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Swagger/code-gen Migrating from spec v.2 to v.3 Book about how to extend swagger/code-gen for your language/stack: http://bit.ly/codegen101
  • 22. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam 3. Service Driven  The Service defines the contract  The OpenAPI spec is generated by a library using reflection over the service.  Requires taking special care to NOT TO break the API compatibility.  Sample: https://openapi3.herokuapp.com  Source: https://github.com/pjmolina/event-backend API Client
  • 23. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Resources Maintainer of:  baucis-swagger2 Generates v.2 contracts for Baucis backends  https://www.npmjs.com/package/baucis-swagger2  baucis-openapi3 Generates v.3 contracts for Baucis backends  https://www.npmjs.com/package/baucis-openapi3  openapi3-ts TypeScript library for building OpenAPI3 documents  https://www.npmjs.com/package/openapi3-ts
  • 24. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API Management Tools
  • 25. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API Management Tools Examples 3scale Apigee Mashape Kong CA 7Layers Azure API Management IBM Bluemix API Management WSO  Provides an extra layer in front of your API  Managed by 3er parties (externalized) Main features:  Authentication, Authorization  Role-based security  DOS attack protection  Monetization: pay per use  Scaling  Auditing  Usage metrics, analytics
  • 26. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API Versioning  Versioning via URL Versioning via parameter Versioning via headers GET /v1/restaurants?location=SVQ GET /v2/restaurants?location=SVQ&limit=30 GET /restaurants?location=SVQ&limit=30&v=2 GET /restaurants?location=SVQ&limit=30 Version: 2
  • 27. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam API Scalability  Stateless API  Load-balancer to handle traffic (e.g. nginx or ha-proxy)  Distributes traffic to your API servers  DNS, SSL and certs. configured in the load balancer api lb api api #0 #1 #2 443 80
  • 28. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Summing up  OpenAPI is a de-facto standard to manage APIs  Simplifies consumption and API integration  Version 3.0 released in June 2017 Roadmap:  Swagger-codegen porting from v.2 to v.3 (work in progress)  Convergence with Google gRPC Pedro J. Molina · Building APIs with OpenAPI · @pmolinam
  • 29. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Questions? @pmolinam 1 Q = 1 sticker
  • 30. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Thx! @pmolinam
  • 31. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam Extra bonus
  • 32. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam REST  REpresentational State Transfer  Stateless Protocol  Unique URIs per resource  Semantic attached to operations/verbs  GET/PUT/POST/DELETE over HTTP Hypermedia (navigable) GET /actors/42 Accept: application/json 200 OK Content-Type: application/json { "id": 42 "name": "Jessica" "lastname": "Alba" "filmography": "/films/42" }
  • 33. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam MIME Types  Declares encoding Most frequents are:  JSON application/json  XML text/xml  HTML text/html  Plain text text/plain  CSV text/csv GET /actors/42 Accept: text/xml 200 OK Content-Type: text/xml <actor id="42"> <name>Jessica</name> <lastname>Alba</lastname> <filmography url= "/films/42" /> </actor>
  • 34. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam REST Levels Richarson Maturity Model http://martinfowler.com/articles/richardsonMaturityModel.html Level 0. HTTP and nothing else (RPC under HTTP) Level 1. Resources GET /invoice/217 Level 2. Using the semantinc of verbs and HTTP error codes POST /invoice/  201 Created https://i.stack.imgur.com/whhD1.png https://httpstatuses.com Level 3. Hypermedia Controls <link rel=“lines” uri=“/factura/217/lineas”/>
  • 35. Pedro J. Molina · Building APIs with OpenAPI · @pmolinam HAL { “id”: 1234 “name”: “Alice in Wonderland” “_links”: { “self”: { “href”: “/book/10”}, “prev”: { “href”: “/book/9”}, “next”: { “href”: “/book/11”}, “action-delete”: { “verb”: “DELETE”, “href”: “/book/10” } } } ://