SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Modern Web APIs with GraphQL
Hélder Vasconcelos
Luis Gonçalves
Outline
● Who are we
● What is a Web API
● Web API Technologies
● What is GraphQL
● GraphQL advantages
● GraphQL vs REST
● Languages that implement GraphQL
● Demo - build GraphQL Api
● Resources
● Q & A
What is a Web API?
An Application Programming Interface – is software programmed
contract written to function as a communication bridge between the web
applications running on the browser and the backend or cloud services.
Web APIS Technologies
- XML Based RPC APIs (SOAP)- a XML based protocol Introduced in Late 90’s.
- AJAX - Introduced in 2005 soon became a popular approach for making web sites dynamic, giving
birth to the "Web 2.0" concept.
- REST (Representational State Transfer) - Introduced on 2000 , uses a passing of resource
representations, as opposed to messages or function calls.
- GraphQL - based on schema types. It was developed internally by Facebook and released as open
source on 2015.
What is GraphQL?
● GraphQL is just a web protocol that specifies the way we build and query remote APIs using a
Tree/JSON like syntax.
● Based on a strongly typed language - GraphQL Schema Definition Language (SDL).
reactorHubNews {
title
description
}
type Post {
title: String!
description: String!
}
What is GraphQL?
● A protocol that allows the client to specify exactly what
data it needs from a model.
● It allows to aggregate data from multiple relations in a
single query.
posts {
title
description
user {
name
}
}
posts {
title
}
GraphQL Type System - Built in scalar types
● Int - An Integer type, example 10
● Float - Floating point number , example 3.43
● String - A sequence of characters , example “Hello World”
● Boolean -
● ID - Object identifier
GraphQL Type System - User Defined Types
● GraphQL uses types to ensure the clients know the fields supported by a resource. The types are
defined by the user following the GraphQL SDL specification
type Post {
title: String!
description: String!
author: User!
}
type User {
fullName: String!
email: String!
}
GraphQL Query
● Used to fetch data from the server using the GraphQL SDL syntax.
● Describe what data the requester wishes to fetch from whoever is fulfilling the GraphQL query.
query reactorNews {
posts(sortedBy: createdDesc) {
title
description
author {
fullName
}
}
}
GraphQL Mutation
● Used to change resources data or execute actions on the server
● Client specifies the arguments and the action to be executed and at the end receives a response or a
resource updated
mutation createPost {
createPost({
title: “Reactor is celebrating a party”
Description: “Beer, sparkling water and much more….:)” })
{
id
title
}
}
GraphQL Subscription
● Used to get realtime resource or data updates
● Users get a notification every time the resource subscribed gets updated or changed.
subscription newSubscriber {
newsLetterSubscriberCreated{
id
subscriber {
fullName
email
}
createAt
}
}
GraphQL Advantages
● You get the data you request and need for a particular scope
● Excellent developer tooling and experiences since the specification defines API introspection
● Only one endpoint to connect,
○ Example POST api.reactorhub.com /graphql/api
GraphQL vs REST
● GraphQL has only one url/endpoint
● In REST, the layout and size of data returned is determined by the server . The server has a
predetermined amount of properties and relations that sends on a call.
● In REST, to retrieve relational data you need to make multiples API calls making the data data
rendering more
GraphQL implementations
● C# / .NET
● Clojure
● Elixir
● Erlang
● Go
● Groovy
Client:Server:
● C# / .NET
● Clojurescript
● Go
● Java / Android
● JavaScript
● Swift / Objective-C iOS
● Python
● Java
● JavaScript
● PHP
● Python
● Scala
● Ruby
Demo
- Let’s create a GraphQL API in node.js
- Create GraphQL server with ApolloServer
- Use gql to define schema ( typedefs )
- types
- Queries
- Mutations
- Define resolvers.
- Show playground to explore and test API
Resources
- Sites
- GraphQL ( https://graphql.org/ )
- GraphQL Weekly newsletter ( https://www.graphqlweekly.com/ )
- GraphQL Cheat Sheet ( https://github.com/sogko/graphql-schema-language-cheat-sheet )
- Apollo ( https://www.apollographql.com/ )
- Prisma ( https://www.prisma.io/ )
- Hasura ( https://hasura.io/ )
- GraphQL Yoga ( https://github.com/prisma/graphql-yoga )
- Podcasts
- https://graphqlpatterns.simplecast.fm/
- https://graphqlradio.com/ ( last episode > 1 year ago )
- Books
- The Road to GraphQL (free ebook)
Thanks! Any Questions ?
helder@taikai.network @heldervasc
luis@taikai.network @luisfigoncalves
www.taikai.network

Contenu connexe

Tendances

GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsSashko Stubailo
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually restJakub Riedl
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQLSquareboat
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingSashko Stubailo
 
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)Ayla Khan
 
Graphql presentation
Graphql presentationGraphql presentation
Graphql presentationVibhor Grover
 
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorWhy UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorJon Wong
 
Apollo server II
Apollo server IIApollo server II
Apollo server IINodeXperts
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016Brad Pillow
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL StackSashko Stubailo
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsSashko Stubailo
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL IntroductionSerge Huber
 

Tendances (20)

Apollo Server
Apollo ServerApollo Server
Apollo Server
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer tools
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
 
GraphQL
GraphQLGraphQL
GraphQL
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)
Build GraphQL APIs with Graphene (Big Mountain Data & Dev 2019)
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
Graphql presentation
Graphql presentationGraphql presentation
Graphql presentation
 
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorWhy UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
 
GraphQL & Relay
GraphQL & RelayGraphQL & Relay
GraphQL & Relay
 
Apollo server II
Apollo server IIApollo server II
Apollo server II
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend Devs
 
GraphQL Fundamentals
GraphQL FundamentalsGraphQL Fundamentals
GraphQL Fundamentals
 
GraphQL
GraphQLGraphQL
GraphQL
 
Graphql
GraphqlGraphql
Graphql
 
GraphQL Search
GraphQL SearchGraphQL Search
GraphQL Search
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 

Similaire à Modern APIs with 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 PHPAndrew Rota
 
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Seven Peaks Speaks
 
Exposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsExposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsWSO2
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfKnoldus Inc.
 
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 accessConnected Data World
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLMatthew Groves
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for GraphQLVMware Tanzu
 
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) ExtensionVMware Tanzu
 
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 togetherSashko Stubailo
 
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
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL APISean O'Brien
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)Chris Grice
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservicesMohammed Shaban
 
API Management for GraphQL
API Management for GraphQLAPI Management for GraphQL
API Management for GraphQLWSO2
 
Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Harald J. Loydl
 

Similaire à Modern APIs with GraphQL (20)

Graphql usage
Graphql usageGraphql usage
Graphql usage
 
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
 
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
 
Exposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIsExposing GraphQLs as Managed APIs
Exposing GraphQLs as Managed APIs
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
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
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for 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 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
 
Hands On - GraphQL
Hands On - GraphQLHands On - GraphQL
Hands On - GraphQL
 
Let's talk about GraphQL
Let's talk about GraphQLLet's talk about GraphQL
Let's talk about GraphQL
 
GraphQl Introduction
GraphQl IntroductionGraphQl Introduction
GraphQl Introduction
 
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
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL API
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
 
Elixir absinthe-basics
Elixir absinthe-basicsElixir absinthe-basics
Elixir absinthe-basics
 
API Management for GraphQL
API Management for GraphQLAPI Management for GraphQL
API Management for GraphQL
 
Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)
 

Dernier

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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.pdfEnterprise Knowledge
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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.pdfUK Journal
 
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)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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 MenDelhi Call girls
 

Dernier (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
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)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 

Modern APIs with GraphQL

  • 1. Modern Web APIs with GraphQL Hélder Vasconcelos Luis Gonçalves
  • 2. Outline ● Who are we ● What is a Web API ● Web API Technologies ● What is GraphQL ● GraphQL advantages ● GraphQL vs REST ● Languages that implement GraphQL ● Demo - build GraphQL Api ● Resources ● Q & A
  • 3. What is a Web API? An Application Programming Interface – is software programmed contract written to function as a communication bridge between the web applications running on the browser and the backend or cloud services.
  • 4. Web APIS Technologies - XML Based RPC APIs (SOAP)- a XML based protocol Introduced in Late 90’s. - AJAX - Introduced in 2005 soon became a popular approach for making web sites dynamic, giving birth to the "Web 2.0" concept. - REST (Representational State Transfer) - Introduced on 2000 , uses a passing of resource representations, as opposed to messages or function calls. - GraphQL - based on schema types. It was developed internally by Facebook and released as open source on 2015.
  • 5. What is GraphQL? ● GraphQL is just a web protocol that specifies the way we build and query remote APIs using a Tree/JSON like syntax. ● Based on a strongly typed language - GraphQL Schema Definition Language (SDL). reactorHubNews { title description } type Post { title: String! description: String! }
  • 6. What is GraphQL? ● A protocol that allows the client to specify exactly what data it needs from a model. ● It allows to aggregate data from multiple relations in a single query. posts { title description user { name } } posts { title }
  • 7. GraphQL Type System - Built in scalar types ● Int - An Integer type, example 10 ● Float - Floating point number , example 3.43 ● String - A sequence of characters , example “Hello World” ● Boolean - ● ID - Object identifier
  • 8. GraphQL Type System - User Defined Types ● GraphQL uses types to ensure the clients know the fields supported by a resource. The types are defined by the user following the GraphQL SDL specification type Post { title: String! description: String! author: User! } type User { fullName: String! email: String! }
  • 9. GraphQL Query ● Used to fetch data from the server using the GraphQL SDL syntax. ● Describe what data the requester wishes to fetch from whoever is fulfilling the GraphQL query. query reactorNews { posts(sortedBy: createdDesc) { title description author { fullName } } }
  • 10. GraphQL Mutation ● Used to change resources data or execute actions on the server ● Client specifies the arguments and the action to be executed and at the end receives a response or a resource updated mutation createPost { createPost({ title: “Reactor is celebrating a party” Description: “Beer, sparkling water and much more….:)” }) { id title } }
  • 11. GraphQL Subscription ● Used to get realtime resource or data updates ● Users get a notification every time the resource subscribed gets updated or changed. subscription newSubscriber { newsLetterSubscriberCreated{ id subscriber { fullName email } createAt } }
  • 12. GraphQL Advantages ● You get the data you request and need for a particular scope ● Excellent developer tooling and experiences since the specification defines API introspection ● Only one endpoint to connect, ○ Example POST api.reactorhub.com /graphql/api
  • 13. GraphQL vs REST ● GraphQL has only one url/endpoint ● In REST, the layout and size of data returned is determined by the server . The server has a predetermined amount of properties and relations that sends on a call. ● In REST, to retrieve relational data you need to make multiples API calls making the data data rendering more
  • 14. GraphQL implementations ● C# / .NET ● Clojure ● Elixir ● Erlang ● Go ● Groovy Client:Server: ● C# / .NET ● Clojurescript ● Go ● Java / Android ● JavaScript ● Swift / Objective-C iOS ● Python ● Java ● JavaScript ● PHP ● Python ● Scala ● Ruby
  • 15. Demo - Let’s create a GraphQL API in node.js - Create GraphQL server with ApolloServer - Use gql to define schema ( typedefs ) - types - Queries - Mutations - Define resolvers. - Show playground to explore and test API
  • 16. Resources - Sites - GraphQL ( https://graphql.org/ ) - GraphQL Weekly newsletter ( https://www.graphqlweekly.com/ ) - GraphQL Cheat Sheet ( https://github.com/sogko/graphql-schema-language-cheat-sheet ) - Apollo ( https://www.apollographql.com/ ) - Prisma ( https://www.prisma.io/ ) - Hasura ( https://hasura.io/ ) - GraphQL Yoga ( https://github.com/prisma/graphql-yoga ) - Podcasts - https://graphqlpatterns.simplecast.fm/ - https://graphqlradio.com/ ( last episode > 1 year ago ) - Books - The Road to GraphQL (free ebook)
  • 17. Thanks! Any Questions ? helder@taikai.network @heldervasc luis@taikai.network @luisfigoncalves www.taikai.network