SlideShare a Scribd company logo
1 of 22
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
+
A query language for your API
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
query {
user(id:18794326) {
name
events {
count
}
friends_suggestions(first: 1) {
name
mutual_friends {
count
}
}
}
}
{
"data": {
"user": {
"name": "Brandon Minnick",
"events": {
"count": 4
},
"friends_suggestions": [{
"name": "Seth Juarez",
"mutual_friends": {
"count": 18
}
}
]
}
}
}
Query Response
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
GraphQL APIs Are Self Documenting
Users can explore GraphQL APIs using GraphiQL
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
{ “query” : “[Your GraphQL Query]” }
GraphQL Request Body is JSON
JSON contains one field: query
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
 GraphQL.Client
 Open Source (17+ Contributors)
 8.9M NuGet Downloads
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
dotnet new tool-manifest
dotnet tool install StrawberryShake.Tools --local
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
dotnet graphql init https://[GraphQL API]
Auto-Initalize GraphQL Schema
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
Resources
https://codetraveler.io/consuming-graphql/
@TheCodeTraveler https://codetraveler.io/consuming-graphql/
Thank You
https://codetraveler.io/consuming-graphql/

More Related Content

Similar to Consuming GraphQL APIs in C#.pptx

BruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedBruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedMarcinStachniuk
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
 
GraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoGraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoMarcinStachniuk
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedMarcinStachniuk
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑Pokai Chang
 
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBaseHBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBaseHBaseCon
 
Expanding APIs beyond the Web
Expanding APIs beyond the WebExpanding APIs beyond the Web
Expanding APIs beyond the WebTim Messerschmidt
 
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyGraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyMarcinStachniuk
 
GraphQL, l'avenir du REST par François ZANINOTTO
GraphQL, l'avenir du REST par François ZANINOTTOGraphQL, l'avenir du REST par François ZANINOTTO
GraphQL, l'avenir du REST par François ZANINOTTOLa Cuisine du Web
 
Using Stargate APIs for Cassandra-Backed Applications
Using Stargate APIs for Cassandra-Backed ApplicationsUsing Stargate APIs for Cassandra-Backed Applications
Using Stargate APIs for Cassandra-Backed ApplicationsNordic APIs
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBAlex Zyl
 
GraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIGraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIVladimir Dejanovic
 
Redis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightRedis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightGuy Korland
 
HackMIT Presentation
HackMIT PresentationHackMIT Presentation
HackMIT PresentationMatt Harris
 

Similar to Consuming GraphQL APIs in C#.pptx (20)

BruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedBruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
 
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptxBuilding GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoGraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za mało
 
Esperwhispering
EsperwhisperingEsperwhispering
Esperwhispering
 
Xamarin + GraphQL
Xamarin + GraphQLXamarin + GraphQL
Xamarin + GraphQL
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑
 
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBaseHBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
HBaseCon 2015: S2Graph - A Large-scale Graph Database with HBase
 
Data exchange formats
Data exchange formatsData exchange formats
Data exchange formats
 
Expanding APIs beyond the Web
Expanding APIs beyond the WebExpanding APIs beyond the Web
Expanding APIs beyond the Web
 
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyGraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
 
GraphQL, l'avenir du REST par François ZANINOTTO
GraphQL, l'avenir du REST par François ZANINOTTOGraphQL, l'avenir du REST par François ZANINOTTO
GraphQL, l'avenir du REST par François ZANINOTTO
 
Using Stargate APIs for Cassandra-Backed Applications
Using Stargate APIs for Cassandra-Backed ApplicationsUsing Stargate APIs for Cassandra-Backed Applications
Using Stargate APIs for Cassandra-Backed Applications
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
GraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIGraphQL vs Traditional Rest API
GraphQL vs Traditional Rest API
 
Redis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightRedis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsight
 
HackMIT Presentation
HackMIT PresentationHackMIT Presentation
HackMIT Presentation
 

More from Brandon Minnick, MBA

Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxBrandon Minnick, MBA
 
Correcting Common Mistakes, AsyncAwait.pptx
Correcting Common Mistakes, AsyncAwait.pptxCorrecting Common Mistakes, AsyncAwait.pptx
Correcting Common Mistakes, AsyncAwait.pptxBrandon Minnick, MBA
 
The .NET MAUI Community Toolkits.pptx
The .NET MAUI Community Toolkits.pptxThe .NET MAUI Community Toolkits.pptx
The .NET MAUI Community Toolkits.pptxBrandon Minnick, MBA
 
Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxBrandon Minnick, MBA
 
Correcting Common Async Await Mistakes in .NET
Correcting Common Async Await Mistakes in .NET Correcting Common Async Await Mistakes in .NET
Correcting Common Async Await Mistakes in .NET Brandon Minnick, MBA
 
Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxBrandon Minnick, MBA
 
Correcting Common .NET Mistakes in Async Await .pptx
Correcting Common .NET Mistakes in Async Await .pptxCorrecting Common .NET Mistakes in Async Await .pptx
Correcting Common .NET Mistakes in Async Await .pptxBrandon Minnick, MBA
 
Introducing .NET MAUI Toolkit.pptx
Introducing .NET MAUI Toolkit.pptxIntroducing .NET MAUI Toolkit.pptx
Introducing .NET MAUI Toolkit.pptxBrandon Minnick, MBA
 
Creating Apps With .NET MAUI for iOS, Android, macOS + Windows
Creating AppsWith .NET MAUIfor iOS, Android, macOS + WindowsCreating AppsWith .NET MAUIfor iOS, Android, macOS + Windows
Creating Apps With .NET MAUI for iOS, Android, macOS + WindowsBrandon Minnick, MBA
 
Creating iOS & Android Apps using Xamarin
Creating iOS & Android Apps using XamarinCreating iOS & Android Apps using Xamarin
Creating iOS & Android Apps using XamarinBrandon Minnick, MBA
 
Creating Native iOS & Android Apps in C#
Creating Native iOS & Android Apps in C#Creating Native iOS & Android Apps in C#
Creating Native iOS & Android Apps in C#Brandon Minnick, MBA
 
DevReach: Creating Xamarin.Forms UIs in C#
DevReach: Creating Xamarin.Forms UIs in C#DevReach: Creating Xamarin.Forms UIs in C#
DevReach: Creating Xamarin.Forms UIs in C#Brandon Minnick, MBA
 

More from Brandon Minnick, MBA (20)

Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptx
 
Correcting Common Mistakes, AsyncAwait.pptx
Correcting Common Mistakes, AsyncAwait.pptxCorrecting Common Mistakes, AsyncAwait.pptx
Correcting Common Mistakes, AsyncAwait.pptx
 
The .NET MAUI Community Toolkits.pptx
The .NET MAUI Community Toolkits.pptxThe .NET MAUI Community Toolkits.pptx
The .NET MAUI Community Toolkits.pptx
 
Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptx
 
Correcting Common Async Await Mistakes in .NET
Correcting Common Async Await Mistakes in .NET Correcting Common Async Await Mistakes in .NET
Correcting Common Async Await Mistakes in .NET
 
AWS Toolkit.pptx
AWS Toolkit.pptxAWS Toolkit.pptx
AWS Toolkit.pptx
 
Building MAUI UIs in C#.pptx
Building MAUI UIs in C#.pptxBuilding MAUI UIs in C#.pptx
Building MAUI UIs in C#.pptx
 
Creating Apps with .NET MAUI.pptx
Creating Apps with .NET MAUI.pptxCreating Apps with .NET MAUI.pptx
Creating Apps with .NET MAUI.pptx
 
Introduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptxIntroduction to Serverless with AWS Lambda in C#.pptx
Introduction to Serverless with AWS Lambda in C#.pptx
 
Correcting Common .NET Mistakes in Async Await .pptx
Correcting Common .NET Mistakes in Async Await .pptxCorrecting Common .NET Mistakes in Async Await .pptx
Correcting Common .NET Mistakes in Async Await .pptx
 
Introducing .NET MAUI Toolkit.pptx
Introducing .NET MAUI Toolkit.pptxIntroducing .NET MAUI Toolkit.pptx
Introducing .NET MAUI Toolkit.pptx
 
Building MAUI UI in C#.pptx
Building MAUI UI in C#.pptxBuilding MAUI UI in C#.pptx
Building MAUI UI in C#.pptx
 
Creating Apps with .NET MAUI
Creating Apps with .NET MAUICreating Apps with .NET MAUI
Creating Apps with .NET MAUI
 
Creating Apps With .NET MAUI for iOS, Android, macOS + Windows
Creating AppsWith .NET MAUIfor iOS, Android, macOS + WindowsCreating AppsWith .NET MAUIfor iOS, Android, macOS + Windows
Creating Apps With .NET MAUI for iOS, Android, macOS + Windows
 
Creating Xamarin.Forms UIs is C#
Creating Xamarin.Forms UIs is C#Creating Xamarin.Forms UIs is C#
Creating Xamarin.Forms UIs is C#
 
The Future of Xamarin
The Future of XamarinThe Future of Xamarin
The Future of Xamarin
 
Creating iOS & Android Apps using Xamarin
Creating iOS & Android Apps using XamarinCreating iOS & Android Apps using Xamarin
Creating iOS & Android Apps using Xamarin
 
Creating Native iOS & Android Apps in C#
Creating Native iOS & Android Apps in C#Creating Native iOS & Android Apps in C#
Creating Native iOS & Android Apps in C#
 
DevReach: Creating Xamarin.Forms UIs in C#
DevReach: Creating Xamarin.Forms UIs in C#DevReach: Creating Xamarin.Forms UIs in C#
DevReach: Creating Xamarin.Forms UIs in C#
 
The Future of Xamarin
The Future of XamarinThe Future of Xamarin
The Future of Xamarin
 

Recently uploaded

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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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 SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

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
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Consuming GraphQL APIs in C#.pptx

Editor's Notes

  1. using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using GraphQL.Client; using GraphQL.Client.Http; using GraphQL.Common.Request; using GraphQL.Common.Response; using Newtonsoft.Json; using Xamarin.Forms; namespace XamarinGraphQL { // Learn more about making custom code visible in the Xamarin.Forms previewer // by visiting https://aka.ms/xamarinforms-previewer [DesignTimeVisible(false)] public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } protected override async void OnAppearing() { base.OnAppearing(); ResponseLabel.Text = "Retrieving Data..."; var client = new HttpClient(); client.DefaultRequestHeaders.Add("User-Agent", nameof(XamarinGraphQL)); client.DefaultRequestHeaders.Add("Authorization", "bearer ceeddf326115d5f094526b7f29fe980e565e497d"); var stringContent = new StringContent("{ \"query\":\"query{ user(login: brminnick) { bio, company, createdAt }}\"}"); var response = await client.PostAsync("https://api.github.com/graphql", stringContent); var json = await response.Content.ReadAsStringAsync(); var userResponse = JsonConvert.DeserializeObject<UserResponse>(json); ResponseLabel.Text = userResponse.Data.User.Bio; } } } -------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; using GraphQL.Client; using GraphQL.Client.Http; using GraphQL.Common.Request; using GraphQL.Common.Response; using ModernHttpClient; using Newtonsoft.Json; using Xamarin.Forms; namespace XamarinGraphQL { // Learn more about making custom code visible in the Xamarin.Forms previewer // by visiting https://aka.ms/xamarinforms-previewer [DesignTimeVisible(false)] public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } protected override async void OnAppearing() { base.OnAppearing(); ResponseLabel.Text = "Retrieving Data..."; var options = new GraphQLHttpClientOptions { EndPoint = new Uri("https://api.github.com/graphql"), HttpMessageHandler = new NativeMessageHandler() }; var client = new GraphQLHttpClient(options); client.DefaultRequestHeaders.Add("User-Agent", nameof(XamarinGraphQL)); client.DefaultRequestHeaders.Add("Authorization", "bearer ceeddf326115d5f094526b7f29fe980e565e497d"); GraphQLResponse response = await client.SendQueryAsync(new GraphQLRequest { Query = "query{ user(login: brminnick) { bio, company, createdAt }}" }); var bio = response.Data.user.bio; var company = response.GetDataFieldAs<User>("user").Company; var createdAt = response.GetDataFieldAs<User>(nameof(User).ToLower()).CreatedAt; ResponseLabel.Text = $"createdAt: {createdAt}\n\nbio: {bio}\n\ncompany: {company}"; } } }