SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Building APIs
with the OpenAPISpec
Dr. Pedro J. Molina
CEOat Metadev @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
@pmolinam
Agenda
 API Economy
 OpenAPI
 User Cases
 Versioning
 Future
Application Programmer Interface
Services ready for 3er partiesto
consume
Technical Description (dev. oriented)
Promotes system integration by
clear contracts durable intime
API Economy
APIs define plataforms.
Twitter, Twilio, Google Mapsas API samples.
You can’t win without anecosystem.
You can’t have an ecosystem without an API.
First one take it all  market share
API
API as a contract with customers
Language agnostic APIs
1. CORBA >> C+ IDL
2. SOA >> XML + SOAP + WDSL …
3. REST >> JSON + HTTP
OpenAPI Initiative
De facto standard (previously: Swagger)
Linux Foundation https://www.openapis.org
Formal contract description for a RESTAPI useful forboth
humans and machines.
Contract described in JSON orYAML
OpenAPI Initiative
http://editor.swagger.io
http://petstore.swagger.io
Tooling
 Editor
 API Explorer
 Validator
https://online.swagger.io/validator
Opensource Generators:
 skeletons for back-ends
 proxies for front-end
http://swagger.io/swagger-codegen
Use cases
1. Legacy API
2. Contract First
3. Service driven
1. Legacy API
API
Document an existing API
Contract creation http://editor.swagger.io
Validation
Results:
 API docs
 SDK generation for clients
1. Legacy API. Sample
Is Nieves a girl’s or boy’s name?
Web service to discoverit:
http://www.jerolba.com/mujeres-y-hombres-y-serverless
GEThttps://us-central1-hombre-o-mujer.cloudfunctions.net/gender?name=nieves
Credits to: Jerónimo López @jerolba
API
1. Legacy API. Contract
API
http://bit.ly/gender-swagger
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.
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
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
2. Contract First
Spec is written in firstplace
http://editor.swagger.io
Can generate:
 a skeleton for backend
 a proxy or SDKfor consumers
 enables parallel work on backend and frontend teams.
 contract change can be versioned in a proper way.
API Client
2. Contract First. Available server stacks
2. Contract First. Available front-end stacks
Swagger/code-gen
Migrating fromspec v.2 to v.3
Book about how to extend swagger/code-gen for your
language/stack:
http://bit.ly/codegen101
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 theAPI compatibility.
Sample: https://openapi3.herokuapp.com
Source: https://github.com/pjmolina/event-backend
API Client
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 forbuilding OpenAPI3 documents
 https://www.npmjs.com/package/openapi3-ts
API Management Tools
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
 DOSattack protection
 Monetization: pay per use
 Scaling
 Auditing
 Usage metrics, analytics
API Versioning
 Versioning via URL
GET /v1/restaurants?location=SVQ
GET /v2/restaurants?location=SVQ&limit=30
Versioning via parameter
GET /restaurants?location=SVQ&limit=30&v=2
Versioning via headers
GET /restaurants?location=SVQ&limit=30
Version: 2
API Scalability
 Stateless API
 Load-balancer to handletraffic
(e.g. nginx or ha-proxy)
 Distributes traffic toyour API
servers
 DNS, SSLand certs. configured in
the load balancer
lb
api #0
api #1
api #2
443
80
Summing up
OpenAPI is a de-facto standard to manage
APIs
Simplifies consumption and APIintegration
Version 3.0 released in June2017
Roadmap:
Swagger-codegen porting from v.2 to v.3
(work in progress)
Convergence with GooglegRPC
Thx!
@pmolinam
Questions?
@pmolinam
Your ideas inaction
https://metadev.pro | @metad3v
Extra bonus
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"
}
MIME Types
 Declares encoding
Most frequents are:
 JSON
 XML
 HTML
 Plain text
 CSV
application/json
text/xml
text/html
text/plain
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>
REST Levels
Richarson Maturity Model
http://martinfowler.com/articles/richardsonMaturityModel.html
GET /invoice/217
POST /invoice/  201 Created
 Level 0. HTTP and nothing else (RPC underHTTP)
 Level 1. Resources
 Level 2. Using the semantinc of verbs and HTTP error
codes https://i.stack.imgur.com/whhD1.png
https://httpstatuses.com
Level 3. HypermediaControls <link rel=“lines”
uri=“/factura/217/lineas”/>
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”
}
}
}
://

Weitere ähnliche Inhalte

Ähnlich wie SVQdotNET: Building APIs with OpenApi

apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...apidays
 
API and Platform Strategies to Win in Global and Local Markets
API and Platform Strategies to Win in Global and Local MarketsAPI and Platform Strategies to Win in Global and Local Markets
API and Platform Strategies to Win in Global and Local MarketsAxway
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewMaría Angélica Bracho
 
Api design best practice
Api design best practiceApi design best practice
Api design best practiceRed Hat
 
GlueCon 2018: Are REST APIs Still Relevant Today?
GlueCon 2018: Are REST APIs Still Relevant Today?GlueCon 2018: Are REST APIs Still Relevant Today?
GlueCon 2018: Are REST APIs Still Relevant Today?LaunchAny
 
Model-driven Round-trip Engineering of REST APIs
Model-driven Round-trip Engineering of REST APIsModel-driven Round-trip Engineering of REST APIs
Model-driven Round-trip Engineering of REST APIsJordi Cabot
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts apiSagarR24
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open StandardsAPIsecure_ Official
 
Running the-next-generation-of-cloud-native-applications-using-open-applicati...
Running the-next-generation-of-cloud-native-applications-using-open-applicati...Running the-next-generation-of-cloud-native-applications-using-open-applicati...
Running the-next-generation-of-cloud-native-applications-using-open-applicati...NaveedAhmad239
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCTim Burks
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts apiSagarR24
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture StrategyOCTO Technology
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCTim Burks
 
Running gRPC Services for Serving Legacy API on Kubernetes
Running gRPC Services for Serving Legacy API on KubernetesRunning gRPC Services for Serving Legacy API on Kubernetes
Running gRPC Services for Serving Legacy API on KubernetesSungwon Lee
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupJosé Román Martín Gil
 
Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?LaunchAny
 
Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Nordic APIs
 

Ähnlich wie SVQdotNET: Building APIs with OpenApi (20)

Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
apidays LIVE Paris 2021 - Getting started with Event-Driven APis by Hugo Guer...
 
API and Platform Strategies to Win in Global and Local Markets
API and Platform Strategies to Win in Global and Local MarketsAPI and Platform Strategies to Win in Global and Local Markets
API and Platform Strategies to Win in Global and Local Markets
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
 
Api design best practice
Api design best practiceApi design best practice
Api design best practice
 
GlueCon 2018: Are REST APIs Still Relevant Today?
GlueCon 2018: Are REST APIs Still Relevant Today?GlueCon 2018: Are REST APIs Still Relevant Today?
GlueCon 2018: Are REST APIs Still Relevant Today?
 
Model-driven Round-trip Engineering of REST APIs
Model-driven Round-trip Engineering of REST APIsModel-driven Round-trip Engineering of REST APIs
Model-driven Round-trip Engineering of REST APIs
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts api
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
 
Running the-next-generation-of-cloud-native-applications-using-open-applicati...
Running the-next-generation-of-cloud-native-applications-using-open-applicati...Running the-next-generation-of-cloud-native-applications-using-open-applicati...
Running the-next-generation-of-cloud-native-applications-using-open-applicati...
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
7 network programmability concepts api
7 network programmability concepts api7 network programmability concepts api
7 network programmability concepts api
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture Strategy
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
Running gRPC Services for Serving Legacy API on Kubernetes
Running gRPC Services for Serving Legacy API on KubernetesRunning gRPC Services for Serving Legacy API on Kubernetes
Running gRPC Services for Serving Legacy API on Kubernetes
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - Meetup
 
Web Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptxWeb Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptx
 
Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?Austin API Summit 2018: Are REST APIs Still Relevant Today?
Austin API Summit 2018: Are REST APIs Still Relevant Today?
 
Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?Are REST APIs Still Relevant Today?
Are REST APIs Still Relevant Today?
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
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 connectorsNanddeep Nachan
 
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, ...apidays
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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 educationjfdjdjcjdnsjd
 
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 Takeoffsammart93
 
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
 
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
 

Kürzlich hochgeladen (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
+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...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
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
 
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, ...
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
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
 
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
 
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...
 

SVQdotNET: Building APIs with OpenApi

  • 1. Building APIs with the OpenAPISpec Dr. Pedro J. Molina CEOat Metadev @pmolinam
  • 2. What’s common here? Library 1 Library 2 Shop N Service 1 Service 2 Service N mLab SendGrid Plugin N API API API Ecosystems
  • 4. Agenda  API Economy  OpenAPI  User Cases  Versioning  Future
  • 5. Application Programmer Interface Services ready for 3er partiesto consume Technical Description (dev. oriented) Promotes system integration by clear contracts durable intime
  • 6. API Economy APIs define plataforms. Twitter, Twilio, Google Mapsas API samples. You can’t win without anecosystem. You can’t have an ecosystem without an API. First one take it all  market share
  • 7. API API as a contract with customers
  • 8. Language agnostic APIs 1. CORBA >> C+ IDL 2. SOA >> XML + SOAP + WDSL … 3. REST >> JSON + HTTP
  • 9. OpenAPI Initiative De facto standard (previously: Swagger) Linux Foundation https://www.openapis.org Formal contract description for a RESTAPI useful forboth humans and machines. Contract described in JSON orYAML
  • 10.
  • 11. OpenAPI Initiative http://editor.swagger.io http://petstore.swagger.io Tooling  Editor  API Explorer  Validator https://online.swagger.io/validator Opensource Generators:  skeletons for back-ends  proxies for front-end http://swagger.io/swagger-codegen
  • 12. Use cases 1. Legacy API 2. Contract First 3. Service driven
  • 13. 1. Legacy API API Document an existing API Contract creation http://editor.swagger.io Validation Results:  API docs  SDK generation for clients
  • 14. 1. Legacy API. Sample Is Nieves a girl’s or boy’s name? Web service to discoverit: http://www.jerolba.com/mujeres-y-hombres-y-serverless GEThttps://us-central1-hombre-o-mujer.cloudfunctions.net/gender?name=nieves Credits to: Jerónimo López @jerolba API
  • 15. 1. Legacy API. Contract API http://bit.ly/gender-swagger 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.
  • 16. 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. 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. 2. Contract First Spec is written in firstplace http://editor.swagger.io Can generate:  a skeleton for backend  a proxy or SDKfor consumers  enables parallel work on backend and frontend teams.  contract change can be versioned in a proper way. API Client
  • 19. 2. Contract First. Available server stacks
  • 20. 2. Contract First. Available front-end stacks
  • 21. Swagger/code-gen Migrating fromspec v.2 to v.3 Book about how to extend swagger/code-gen for your language/stack: http://bit.ly/codegen101
  • 22. 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 theAPI compatibility. Sample: https://openapi3.herokuapp.com Source: https://github.com/pjmolina/event-backend API Client
  • 23. 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 forbuilding OpenAPI3 documents  https://www.npmjs.com/package/openapi3-ts
  • 25. 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  DOSattack protection  Monetization: pay per use  Scaling  Auditing  Usage metrics, analytics
  • 26. API Versioning  Versioning via URL GET /v1/restaurants?location=SVQ GET /v2/restaurants?location=SVQ&limit=30 Versioning via parameter GET /restaurants?location=SVQ&limit=30&v=2 Versioning via headers GET /restaurants?location=SVQ&limit=30 Version: 2
  • 27. API Scalability  Stateless API  Load-balancer to handletraffic (e.g. nginx or ha-proxy)  Distributes traffic toyour API servers  DNS, SSLand certs. configured in the load balancer lb api #0 api #1 api #2 443 80
  • 28. Summing up OpenAPI is a de-facto standard to manage APIs Simplifies consumption and APIintegration Version 3.0 released in June2017 Roadmap: Swagger-codegen porting from v.2 to v.3 (work in progress) Convergence with GooglegRPC
  • 33. 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" }
  • 34. MIME Types  Declares encoding Most frequents are:  JSON  XML  HTML  Plain text  CSV application/json text/xml text/html text/plain 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>
  • 35. REST Levels Richarson Maturity Model http://martinfowler.com/articles/richardsonMaturityModel.html GET /invoice/217 POST /invoice/  201 Created  Level 0. HTTP and nothing else (RPC underHTTP)  Level 1. Resources  Level 2. Using the semantinc of verbs and HTTP error codes https://i.stack.imgur.com/whhD1.png https://httpstatuses.com Level 3. HypermediaControls <link rel=“lines” uri=“/factura/217/lineas”/>
  • 36. 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” } } } ://