SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Exposing GraphQLs as Managed APIs
Fazlan Nazeem, Associate Technical Lead, WSO2
Hiranya Abeyrathne, Software Engineer, WSO2
Agenda
● Introduction to GraphQL
● REST vs GraphQL
● Why API Management
● Graphql Support - WSO2 APIM 3.0.0
● Demo
● Roadmap of upcoming GraphQL features.
● Q&A
Introduction to GraphQL
GraphQL
● A query language for your API. Not a programming language.
● Ask what you need, and get exactly that.
● Developed internally by Facebook in 2012 before being publicly released
in 2015.
● Specification : https://graphql.github.io/graphql-spec/June2018/
● Reference Implementation: https://github.com/graphql/graphql-js
● Implementations of the GraphQL client, server in various languages are
available. https://graphql.org/code/
● GraphQL foundation : Airbnb, AWS, Apollo, Coursera, Facebook, GitHub,
Prisma, Shopify, IBM and Twitter
● Typically served over HTTP via a single endpoint which expresses the full
set of capabilities of the service.
Type System
● Defines the capabilities of an API
● All the types are exposed in an API, written
down in a language called (SDL) GraphQL
Schema Definition Language
● Contract between the client and the server.
Once it is defined, both sides are aware of
the data structure
● There are some special root types
(Query,Mutation,Subscription) - operations
Query
Fetching Data with Queries
Ex1: Facebook
Query (Contd)
Ex2: Github
Mutation
Writing data with Mutations (Making changes to the data stored in the
backend - create/update/delete)
● POST : <Endpoint URL> payload: { query: “mutation createPerson {name:
‘Alice, age:36’}”}
mutation {
createPerson(name: "Alice",age: 36) {
Id
}
}
{
"data": {
"createPerson": {
"id": "1234"
}
}
}
Subscription
Real time updates with Subscriptions (Have a real time connection to the
server)
subscription {
submitComment {
message
}
}
REST vs GraphQL
Rest vs GraphQL (Contd)
Ex: An app needs to display the titles of the
posts of a specific user. The same screen also
displays the names of the last 3 followers of
that user. How would that situation be solved
with REST and GraphQL?
REST : Accessing multiple Endpoints
/users/<id> - Fetch initial user data
/users/<id>/posts - Fetch all the posts for a user
/users/<id>/followers - Returns a list of
followers per user.
Rest vs GraphQL (Contd)
GraphQL : Sends a single
query
Pass the query to the
GraphQL server that includes
the concrete data
requirements. ( The client can
specify exactly the data it
needs in a query)
GraphQL Strengths and Weaknesses
• No more Over-fetching and Under-fetching
• Rapid Product Iterations on the Frontend
• Insightful Analytics on the Backend
• Benefits of a Schema & Type System
• Queries send more bytes than REST
• Caching is complicated
• Server needs to do more processing
• Extra cautions for GraphQL specific attacks
Why API Management?
API Management for GraphQL Services
• First class support for creating/publishing GraphQL APIs.
• Different levels of permissions for each operation.
• Different levels of rate limiting levels for each operation.
• Threat Protection ( Malicious/unintentional/Poor Queries )
• Operational Level Analytics.
Graphql Support
WSO2 APIM 3.0
What WSO2 APIM 3.0 Offers?
● First class support for Graphql APIs
○ Create a Graphql API by importing an SDL schema
○ Identify Graphql APIs automatically in the portals
○ Display operation list instead of resources
○ Display SDL schema instead of open API definition
○ Download option for SDL schema
○ Search option to Graphql type APIs ( type: GRAPHQL)
● Operational Level Security, Authorization and Rate limiting
Demo
Use Case - API Developer
Mike needs to expose the “Countries” API with the following rules
1. Continents operation needs to be authorized only for managers
2. Continents operation should be allowed for only one request per minute
3. Languages operation needs to be available for everyone
Jane needs to invoke Countries API which
has been published through WSO2 APIM
3.0.0 to retrieve the following.
• Code, name of all languages.
• Name of all countries,
code, name of all languages in each country
• Name of all continents,
Name of all countries in each continent,
Code, name of all languages of each
country.
Use Case - Application Developer
API Invocation
Managed Countries API
Roadmap
● Threat Protection
● Analytics support
● Websocket Subscription
● Micro-gw support
Q & A
● Download and try out: https://wso2.com/api-management/
● Slack Channel:
https://app.slack.com/client/TLVKGQN84/CLVKGR3BN
● GitHub: https://github.com/wso2/product-apim/issues
Webinars to Follow
● November 14 - API Security in a Cloud Native Era
● November 19 - Cloud Native APIs: The API Operator for Kubernetes
● November 21 - Beautifying the Beautiful: Theming WSO2 API
Manager
● December 03 - Mine Your APIs for Gold: API Monetization
● December 05 - Building a CI/CD Pipeline for APIs
THANK YOU
wso2.com

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Beautifying the Beautiful: Theming WSO2 API Manager
Beautifying the Beautiful: Theming WSO2 API ManagerBeautifying the Beautiful: Theming WSO2 API Manager
Beautifying the Beautiful: Theming WSO2 API Manager
 
Exposing Lambda Functions as Managed APIs
Exposing Lambda Functions as Managed APIsExposing Lambda Functions as Managed APIs
Exposing Lambda Functions as Managed APIs
 
Explore the Latest on WSO2 Identity Server 5.11
Explore the Latest on WSO2 Identity Server 5.11Explore the Latest on WSO2 Identity Server 5.11
Explore the Latest on WSO2 Identity Server 5.11
 
How to Build a Scalable, Distributed, Multi-Cloud API Architecture on Kubernetes
How to Build a Scalable, Distributed, Multi-Cloud API Architecture on KubernetesHow to Build a Scalable, Distributed, Multi-Cloud API Architecture on Kubernetes
How to Build a Scalable, Distributed, Multi-Cloud API Architecture on Kubernetes
 
Aliaksei Bahachuk - JavaScript and Solution Architecture
Aliaksei Bahachuk - JavaScript and Solution ArchitectureAliaksei Bahachuk - JavaScript and Solution Architecture
Aliaksei Bahachuk - JavaScript and Solution Architecture
 
Building and Deploying Complex Streaming Data Processing Pipelines with WSO2 ...
Building and Deploying Complex Streaming Data Processing Pipelines with WSO2 ...Building and Deploying Complex Streaming Data Processing Pipelines with WSO2 ...
Building and Deploying Complex Streaming Data Processing Pipelines with WSO2 ...
 
API Management for GraphQL
API Management for GraphQLAPI Management for GraphQL
API Management for GraphQL
 
WSO2 API microgateway introduction
WSO2 API microgateway introductionWSO2 API microgateway introduction
WSO2 API microgateway introduction
 
How to move from Monolith to Microservice
How to move from Monolith to MicroserviceHow to move from Monolith to Microservice
How to move from Monolith to Microservice
 
MuleSoft Surat Virtual Meetup#19 - Identity and Client Management With MuleSoft
MuleSoft Surat Virtual Meetup#19 - Identity and Client Management With MuleSoftMuleSoft Surat Virtual Meetup#19 - Identity and Client Management With MuleSoft
MuleSoft Surat Virtual Meetup#19 - Identity and Client Management With MuleSoft
 
[WSO2Con EU 2018] Up-Leveling Brownfield Integration
[WSO2Con EU 2018] Up-Leveling Brownfield Integration[WSO2Con EU 2018] Up-Leveling Brownfield Integration
[WSO2Con EU 2018] Up-Leveling Brownfield Integration
 
[WSO2Con EU 2018] Enabling Agile Integration Teams
[WSO2Con EU 2018] Enabling Agile Integration Teams[WSO2Con EU 2018] Enabling Agile Integration Teams
[WSO2Con EU 2018] Enabling Agile Integration Teams
 
[WSO2 API Manager Community Call] Expose Services as Managed APIs
[WSO2 API Manager Community Call] Expose Services as Managed APIs [WSO2 API Manager Community Call] Expose Services as Managed APIs
[WSO2 API Manager Community Call] Expose Services as Managed APIs
 
apidays LIVE Australia 2020 - Productising your Microservices as API Products...
apidays LIVE Australia 2020 - Productising your Microservices as API Products...apidays LIVE Australia 2020 - Productising your Microservices as API Products...
apidays LIVE Australia 2020 - Productising your Microservices as API Products...
 
[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with Ballerina[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with Ballerina
 
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
[APIdays INTERFACE 2021] Now that we have K8s, can we stop re-inventing API p...
 
Botvinnik webinar
Botvinnik webinarBotvinnik webinar
Botvinnik webinar
 
Adaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on KubernetesAdaptive Scaling of Microgateways on Kubernetes
Adaptive Scaling of Microgateways on Kubernetes
 
The Fn Project: A Quick Introduction (December 2017)
The Fn Project: A Quick Introduction (December 2017)The Fn Project: A Quick Introduction (December 2017)
The Fn Project: A Quick Introduction (December 2017)
 
Online Meetup - MuleSoft - June 2020
 Online Meetup - MuleSoft - June 2020  Online Meetup - MuleSoft - June 2020
Online Meetup - MuleSoft - June 2020
 

Similar a Exposing GraphQLs as Managed APIs

Similar a Exposing GraphQLs as Managed APIs (20)

Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
 
Modern APIs with GraphQL
Modern APIs with GraphQLModern APIs with GraphQL
Modern APIs with GraphQL
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for GraphQL
 
Rate Limiting GQLs Using Depth and Complexity Analysis
Rate Limiting GQLs Using Depth and Complexity AnalysisRate Limiting GQLs Using Depth and Complexity Analysis
Rate Limiting GQLs Using Depth and Complexity Analysis
 
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
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
GraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database accessGraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database access
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)
 
Attacking GraphQL
Attacking GraphQLAttacking GraphQL
Attacking GraphQL
 
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) ExtensionSimplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
 
Graphql presentation
Graphql presentationGraphql presentation
Graphql presentation
 
Anypoint Data Graphs
Anypoint Data GraphsAnypoint Data Graphs
Anypoint Data Graphs
 
How easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performanceHow easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performance
 

Más de WSO2

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Fueling the Digital Experience Economy with Connected Products
Fueling the Digital Experience Economy with Connected ProductsFueling the Digital Experience Economy with Connected Products
Fueling the Digital Experience Economy with Connected Products
WSO2
 
A Reference Methodology for Agile Digital Businesses
 A Reference Methodology for Agile Digital Businesses A Reference Methodology for Agile Digital Businesses
A Reference Methodology for Agile Digital Businesses
WSO2
 

Más de WSO2 (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
How to Create a Service in Choreo
How to Create a Service in ChoreoHow to Create a Service in Choreo
How to Create a Service in Choreo
 
Ballerina Tech Talk - May 2023
Ballerina Tech Talk - May 2023Ballerina Tech Talk - May 2023
Ballerina Tech Talk - May 2023
 
Platform Strategy to Deliver Digital Experiences on Azure
Platform Strategy to Deliver Digital Experiences on AzurePlatform Strategy to Deliver Digital Experiences on Azure
Platform Strategy to Deliver Digital Experiences on Azure
 
GartnerITSymSessionSlides.pdf
GartnerITSymSessionSlides.pdfGartnerITSymSessionSlides.pdf
GartnerITSymSessionSlides.pdf
 
[Webinar] How to Create an API in Minutes
[Webinar] How to Create an API in Minutes[Webinar] How to Create an API in Minutes
[Webinar] How to Create an API in Minutes
 
Modernizing the Student Journey with Ethos Identity
Modernizing the Student Journey with Ethos IdentityModernizing the Student Journey with Ethos Identity
Modernizing the Student Journey with Ethos Identity
 
Choreo - Build unique digital experiences on WSO2's platform, secured by Etho...
Choreo - Build unique digital experiences on WSO2's platform, secured by Etho...Choreo - Build unique digital experiences on WSO2's platform, secured by Etho...
Choreo - Build unique digital experiences on WSO2's platform, secured by Etho...
 
CIO Summit Berlin 2022.pptx.pdf
CIO Summit Berlin 2022.pptx.pdfCIO Summit Berlin 2022.pptx.pdf
CIO Summit Berlin 2022.pptx.pdf
 
Delivering New Digital Experiences Fast - Introducing Choreo
Delivering New Digital Experiences Fast - Introducing ChoreoDelivering New Digital Experiences Fast - Introducing Choreo
Delivering New Digital Experiences Fast - Introducing Choreo
 
Fueling the Digital Experience Economy with Connected Products
Fueling the Digital Experience Economy with Connected ProductsFueling the Digital Experience Economy with Connected Products
Fueling the Digital Experience Economy with Connected Products
 
A Reference Methodology for Agile Digital Businesses
 A Reference Methodology for Agile Digital Businesses A Reference Methodology for Agile Digital Businesses
A Reference Methodology for Agile Digital Businesses
 
Workflows in WSO2 API Manager - WSO2 API Manager Community Call (12/15/2021)
Workflows in WSO2 API Manager - WSO2 API Manager Community Call (12/15/2021)Workflows in WSO2 API Manager - WSO2 API Manager Community Call (12/15/2021)
Workflows in WSO2 API Manager - WSO2 API Manager Community Call (12/15/2021)
 
Lessons from the pandemic - From a single use case to true transformation
 Lessons from the pandemic - From a single use case to true transformation Lessons from the pandemic - From a single use case to true transformation
Lessons from the pandemic - From a single use case to true transformation
 
Adding Liveliness to Banking Experiences
Adding Liveliness to Banking ExperiencesAdding Liveliness to Banking Experiences
Adding Liveliness to Banking Experiences
 
Building a Future-ready Bank
Building a Future-ready BankBuilding a Future-ready Bank
Building a Future-ready Bank
 
WSO2 API Manager Community Call - November 2021
WSO2 API Manager Community Call - November 2021WSO2 API Manager Community Call - November 2021
WSO2 API Manager Community Call - November 2021
 
[API World ] - Managing Asynchronous APIs
[API World ] - Managing Asynchronous APIs[API World ] - Managing Asynchronous APIs
[API World ] - Managing Asynchronous APIs
 
[API World 2021 ] - Understanding Cloud Native Deployment
[API World 2021 ] - Understanding Cloud Native Deployment[API World 2021 ] - Understanding Cloud Native Deployment
[API World 2021 ] - Understanding Cloud Native Deployment
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Exposing GraphQLs as Managed APIs

  • 1. Exposing GraphQLs as Managed APIs Fazlan Nazeem, Associate Technical Lead, WSO2 Hiranya Abeyrathne, Software Engineer, WSO2
  • 2. Agenda ● Introduction to GraphQL ● REST vs GraphQL ● Why API Management ● Graphql Support - WSO2 APIM 3.0.0 ● Demo ● Roadmap of upcoming GraphQL features. ● Q&A
  • 4. GraphQL ● A query language for your API. Not a programming language. ● Ask what you need, and get exactly that. ● Developed internally by Facebook in 2012 before being publicly released in 2015. ● Specification : https://graphql.github.io/graphql-spec/June2018/ ● Reference Implementation: https://github.com/graphql/graphql-js ● Implementations of the GraphQL client, server in various languages are available. https://graphql.org/code/ ● GraphQL foundation : Airbnb, AWS, Apollo, Coursera, Facebook, GitHub, Prisma, Shopify, IBM and Twitter ● Typically served over HTTP via a single endpoint which expresses the full set of capabilities of the service.
  • 5. Type System ● Defines the capabilities of an API ● All the types are exposed in an API, written down in a language called (SDL) GraphQL Schema Definition Language ● Contract between the client and the server. Once it is defined, both sides are aware of the data structure ● There are some special root types (Query,Mutation,Subscription) - operations
  • 6. Query Fetching Data with Queries Ex1: Facebook
  • 8. Mutation Writing data with Mutations (Making changes to the data stored in the backend - create/update/delete) ● POST : <Endpoint URL> payload: { query: “mutation createPerson {name: ‘Alice, age:36’}”} mutation { createPerson(name: "Alice",age: 36) { Id } } { "data": { "createPerson": { "id": "1234" } } }
  • 9. Subscription Real time updates with Subscriptions (Have a real time connection to the server) subscription { submitComment { message } }
  • 11. Rest vs GraphQL (Contd) Ex: An app needs to display the titles of the posts of a specific user. The same screen also displays the names of the last 3 followers of that user. How would that situation be solved with REST and GraphQL? REST : Accessing multiple Endpoints /users/<id> - Fetch initial user data /users/<id>/posts - Fetch all the posts for a user /users/<id>/followers - Returns a list of followers per user.
  • 12. Rest vs GraphQL (Contd) GraphQL : Sends a single query Pass the query to the GraphQL server that includes the concrete data requirements. ( The client can specify exactly the data it needs in a query)
  • 13. GraphQL Strengths and Weaknesses • No more Over-fetching and Under-fetching • Rapid Product Iterations on the Frontend • Insightful Analytics on the Backend • Benefits of a Schema & Type System • Queries send more bytes than REST • Caching is complicated • Server needs to do more processing • Extra cautions for GraphQL specific attacks
  • 15. API Management for GraphQL Services • First class support for creating/publishing GraphQL APIs. • Different levels of permissions for each operation. • Different levels of rate limiting levels for each operation. • Threat Protection ( Malicious/unintentional/Poor Queries ) • Operational Level Analytics.
  • 17. What WSO2 APIM 3.0 Offers? ● First class support for Graphql APIs ○ Create a Graphql API by importing an SDL schema ○ Identify Graphql APIs automatically in the portals ○ Display operation list instead of resources ○ Display SDL schema instead of open API definition ○ Download option for SDL schema ○ Search option to Graphql type APIs ( type: GRAPHQL) ● Operational Level Security, Authorization and Rate limiting
  • 18. Demo
  • 19. Use Case - API Developer Mike needs to expose the “Countries” API with the following rules 1. Continents operation needs to be authorized only for managers 2. Continents operation should be allowed for only one request per minute 3. Languages operation needs to be available for everyone
  • 20. Jane needs to invoke Countries API which has been published through WSO2 APIM 3.0.0 to retrieve the following. • Code, name of all languages. • Name of all countries, code, name of all languages in each country • Name of all continents, Name of all countries in each continent, Code, name of all languages of each country. Use Case - Application Developer
  • 23. Roadmap ● Threat Protection ● Analytics support ● Websocket Subscription ● Micro-gw support
  • 24. Q & A
  • 25. ● Download and try out: https://wso2.com/api-management/ ● Slack Channel: https://app.slack.com/client/TLVKGQN84/CLVKGR3BN ● GitHub: https://github.com/wso2/product-apim/issues
  • 26. Webinars to Follow ● November 14 - API Security in a Cloud Native Era ● November 19 - Cloud Native APIs: The API Operator for Kubernetes ● November 21 - Beautifying the Beautiful: Theming WSO2 API Manager ● December 03 - Mine Your APIs for Gold: API Monetization ● December 05 - Building a CI/CD Pipeline for APIs