Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Microsoft Graph API Client and OpenAPI
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
jinroq
October 01, 2019
Technology
1.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Microsoft Graph API Client and OpenAPI
jinroq
October 01, 2019
More Decks by jinroq
See All by jinroq
Back to the roots of date
jinroq
0
2k
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
670
Fukuoka.rb 2023 年度活動報告
jinroq
0
570
TRICK 2022 に入選した話
jinroq
0
360
RubyKaigiとMicrosoftと私
jinroq
0
320
msgraph: Microsoft Graph API Client with Ruby
jinroq
0
410
Fukuoka.rb 2019活動報告・2020抱負
jinroq
0
380
福岡の方から参りました Fukuoka.rb です
jinroq
0
2.1k
Fukuoka.rb #150 LT
jinroq
0
350
Other Decks in Technology
See All in Technology
どこまでAIに任せるか 〜確率論と決定論の境界決定〜
shukob
0
560
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
170
AI驚き屋発見器
yama3133
1
380
歴史から理解するクラウドインフラのしくみ
kizawa2020
0
190
AI時代の強いチームの作り方
yuukiyo
1
370
MCPをつなげて作る組織横断のAIエージェント基盤
tsubakimoto_s
0
300
大 AI 時代におけるC# の事情 ~ぶっちゃけトークを交えながら~
nenonaninu
1
530
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
580
最高のシステムプロンプトを作るためにフィードバック機能を導入した話
alchemy1115
0
220
数値で見る Microsoft MVP 〜Spec Kit と GitHub Copilot Agent で作るデータ可視化ダッシュボード〜
yutakaosada
0
170
基調講演:人とAIをつなぐIoTの今と未来 ー 「フィジカル」と「デジタル」が出会うその先へ【SORACOM Discovery 2026】
soracom
PRO
0
360
Claude Code並行開発環境の ムダ‧ムラ‧ムリを見直した話
muranakaaa
0
300
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
440
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
The Language of Interfaces
destraynor
162
27k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
400
Ruling the World: When Life Gets Gamed
codingconduct
0
290
A Soul's Torment
seathinner
6
3.1k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
Skip the Path - Find Your Career Trail
mkilby
1
170
Designing for Performance
lara
611
70k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
Transcript
Microsoft Graph API Client and OpenAPI FGN ΤϯδχΞ Meetup vol.3
ODA Hirohito
Fukuoka.rb ຖिਫ༵։࠵ https://fukuokarb.connpass.com/
Microsoft Graph
Microsoft Graph https://developer.microsoft.com/en-us/graph
Microsoft Graph • ϢʔβʔใΛศརʹѻ͑ΔαʔϏε • Azure AD • Office 365
αʔϏε • OneDrive • ͳͲͳͲ • G Suite ͱΑ͘ൺֱ͞ΕΔ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0
༷ʑͳϓϥοτϑΥʔϜʹରԠ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0#supported-platforms
༷ʑͳϓϥοτϑΥʔϜʹରԠ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0#supported-platforms
2018/06/04 Microsoft ͕ GitHub Λങऩ https://news.microsoft.com/ja-jp/2018/06/05/microsoft-to-acquire-github-for-7-5-billion/
2018/06/04 Microsoft ͕ GitHub Λങऩ https://news.microsoft.com/ja-jp/2018/06/05/microsoft-to-acquire-github-for-7-5-billion/ •ങऩ࣌ʹݴΘΕ͍ͯͨ͜ͱ •GitHub ͷΦʔϓϯιʔεจԽ͕ࣦΘΕͳ͍͔ʁ •GitHub
ͷاۀจԽࣗମ͕େ͖͘มΘͬͯ͠·Θͳ͍͔ʁ
લධΛ১ͯ͠ SDK Λ OSS ͱͯ͠ެ։͍ͯ͠Δ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0#supported-platforms
લධΛ১ͯ͠ SDK Λ OSS ͱͯ͠ެ։͍ͯ͠Δ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0#supported-platforms Α͏ʹݟ͑Δ
ݱ࣮ͱͷ໘
༷ʑͳϓϥοτϑΥʔϜʹରԠ https://docs.microsoft.com/en-us/graph/?view=graph-rest-1.0#supported-platforms
platform URL commits Android https://github.com/microsoftgraph/msgraph-sdk-android 259 Angular https://github.com/microsoftgraph/msgraph-sdk-javascript 469 ASP
.NET https://www.nuget.org/packages/Microsoft.Graph — iOS https://github.com/microsoftgraph/msgraph-sdk-objc 110 Java https://github.com/microsoftgraph/msgraph-sdk-java 445 JavaScript https://github.com/microsoftgraph/msgraph-sdk-javascript 469 Node.js https://github.com/microsoftgraph/msgraph-sdk-javascript 469 PHP https://github.com/microsoftgraph/msgraph-sdk-php 227 Ruby https://github.com/microsoftgraph/msgraph-sdk-ruby 34 UWP https://www.nuget.org/packages/Microsoft.Graph — Xamarin https://www.nuget.org/packages/Microsoft.Graph — SDK ͷ։ൃঢ়گ
platform URL commits Android https://github.com/microsoftgraph/msgraph-sdk-android 259 Angular https://github.com/microsoftgraph/msgraph-sdk-javascript 469 ASP
.NET https://www.nuget.org/packages/Microsoft.Graph — iOS https://github.com/microsoftgraph/msgraph-sdk-objc 110 Java https://github.com/microsoftgraph/msgraph-sdk-java 445 JavaScript https://github.com/microsoftgraph/msgraph-sdk-javascript 469 Node.js https://github.com/microsoftgraph/msgraph-sdk-javascript 469 PHP https://github.com/microsoftgraph/msgraph-sdk-php 227 Ruby https://github.com/microsoftgraph/msgraph-sdk-ruby 34 UWP https://www.nuget.org/packages/Microsoft.Graph — Xamarin https://www.nuget.org/packages/Microsoft.Graph — MS ϓϥοτϑΥʔϜ NuGet ͔Βఏڙ
platform URL commits Android https://github.com/microsoftgraph/msgraph-sdk-android 259 Angular https://github.com/microsoftgraph/msgraph-sdk-javascript 469 ASP
.NET https://www.nuget.org/packages/Microsoft.Graph — iOS https://github.com/microsoftgraph/msgraph-sdk-objc 110 Java https://github.com/microsoftgraph/msgraph-sdk-java 445 JavaScript https://github.com/microsoftgraph/msgraph-sdk-javascript 469 Node.js https://github.com/microsoftgraph/msgraph-sdk-javascript 469 PHP https://github.com/microsoftgraph/msgraph-sdk-php 227 Ruby https://github.com/microsoftgraph/msgraph-sdk-ruby 34 UWP https://www.nuget.org/packages/Microsoft.Graph — Xamarin https://www.nuget.org/packages/Microsoft.Graph — JS ܥඃ͍ͬͯΔ
platform URL commits Android https://github.com/microsoftgraph/msgraph-sdk-android 259 Angular https://github.com/microsoftgraph/msgraph-sdk-javascript 469 ASP
.NET https://www.nuget.org/packages/Microsoft.Graph — iOS https://github.com/microsoftgraph/msgraph-sdk-objc 110 Java https://github.com/microsoftgraph/msgraph-sdk-java 445 JavaScript https://github.com/microsoftgraph/msgraph-sdk-javascript 469 Node.js https://github.com/microsoftgraph/msgraph-sdk-javascript 469 PHP https://github.com/microsoftgraph/msgraph-sdk-php 227 Ruby https://github.com/microsoftgraph/msgraph-sdk-ruby 34 UWP https://www.nuget.org/packages/Microsoft.Graph — Xamarin https://www.nuget.org/packages/Microsoft.Graph — Ͱຊʹண͖͢͜͜ʂ
ݱ࣮ • SDK ༷ʑϓϥοτϑΥʔϜͰରԠ͍ͯ͠Δࣄʹͳ͍ͬͯΔ͕ɺ ϓϥοτϑΥʔϜ͝ͱͷରԠͷ͕ܹ͍ࠩ͠ • Microsoft ؔ࿈ϓϥοτϑΥʔϜԿͰॆ࣮͍ͯ͠Δ • Ruby
ͷରԠ͋·Γʹ͗͢Δ
Ruby ͷରԠঢ়گ
microsoft_graph https://rubygems.org/gems/microsoft_graph
Microsoft Graph Client Library for Ruby https://github.com/microsoftgraph/msgraph-sdk-ruby
׆ൃͱݴ͍͍ gem ͷެ։։࢝ 2016/08/01
ࢀߟ·Ͱʹ… google-api-client https://rubygems.org/gems/google-api-client
ࢀߟ·Ͱʹ… • 2010/10/14 ʹ v. 0.1.0 ެ։ • ݱࡏ v.
0.31.0 • ৽ػೳͷՃͳ͘ɺॏେͳ όάͱηΩϡϦςΟύονͷ Έ https://rubygems.org/gems/google-api-client
Ұํ… microsoft_graph
https://github.com/microsoftgraph/msgraph-sdk-ruby#usage-example require 'adal' require 'microsoft_graph' # authenticate using ADAL username
= '
[email protected]
' password = 'xxxxxxxxxxxx' client_id = 'xxxxx-xxxx-xxx-xxxxxx-xxxxxxx' client_secret = 'xxxXXXxxXXXxxxXXXxxXXXXXXXXxxxxxx=' tenant = 'tenant.onmicrosoft.com' user_cred = ADAL::UserCredential.new(username, password) client_cred = ADAL::ClientCredential.new(client_id, client_secret) context = ADAL::AuthenticationContext.new(ADAL::Authority::WORLD_WIDE_AUTHORITY, tenant) resource = "https://graph.microsoft.com" tokens = context.acquire_token_for_user(resource, client_cred, user_cred) # add the access token to the request header callback = Proc.new { |r| r.headers["Authorization"] = "Bearer #{tokens.access_token}" } graph = MicrosoftGraph.new(base_url: "https://graph.microsoft.com/v1.0", cached_metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, "metadata_v1.0.xml"), api_version: '1.6', # Optional &callback ) me = graph.me # get the current user puts "Hello, I am #{me.display_name}." me.direct_reports.each do |person| puts "How's it going, #{person.display_name}?" end
https://github.com/microsoftgraph/msgraph-sdk-ruby#usage-example require 'adal' require 'microsoft_graph' # authenticate using ADAL username
= '
[email protected]
' password = 'xxxxxxxxxxxx' client_id = 'xxxxx-xxxx-xxx-xxxxxx-xxxxxxx' client_secret = 'xxxXXXxxXXXxxxXXXxxXXXXXXXXxxxxxx=' tenant = 'tenant.onmicrosoft.com' user_cred = ADAL::UserCredential.new(username, password) client_cred = ADAL::ClientCredential.new(client_id, client_secret) context = ADAL::AuthenticationContext.new(ADAL::Authority::WORLD_WIDE_AUTHORITY, tenant) resource = "https://graph.microsoft.com" tokens = context.acquire_token_for_user(resource, client_cred, user_cred) # add the access token to the request header callback = Proc.new { |r| r.headers["Authorization"] = "Bearer #{tokens.access_token}" } graph = MicrosoftGraph.new(base_url: "https://graph.microsoft.com/v1.0", cached_metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, "metadata_v1.0.xml"), api_version: '1.6', # Optional &callback ) me = graph.me # get the current user puts "Hello, I am #{me.display_name}." me.direct_reports.each do |person| puts "How's it going, #{person.display_name}?" end ͜ͷαϯϓϧΛಈ͔͢ͱ…
https://github.com/microsoftgraph/msgraph-sdk-ruby#usage-example require 'adal' require 'microsoft_graph' # authenticate using ADAL username
= '
[email protected]
' password = 'xxxxxxxxxxxx' client_id = 'xxxxx-xxxx-xxx-xxxxxx-xxxxxxx' client_secret = 'xxxXXXxxXXXxxxXXXxxXXXXXXXXxxxxxx=' tenant = 'tenant.onmicrosoft.com' user_cred = ADAL::UserCredential.new(username, password) client_cred = ADAL::ClientCredential.new(client_id, client_secret) context = ADAL::AuthenticationContext.new(ADAL::Authority::WORLD_WIDE_AUTHORITY, tenant) resource = "https://graph.microsoft.com" tokens = context.acquire_token_for_user(resource, client_cred, user_cred) # add the access token to the request header callback = Proc.new { |r| r.headers["Authorization"] = "Bearer #{tokens.access_token}" } graph = MicrosoftGraph.new(base_url: "https://graph.microsoft.com/v1.0", cached_metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, "metadata_v1.0.xml"), api_version: '1.6', # Optional &callback ) me = graph.me # get the current user puts "Hello, I am #{me.display_name}." me.direct_reports.each do |person| puts "How's it going, #{person.display_name}?" end <= ͜͜ͰίέΔ
Microsoft Graph SDK for Ruby ͷ • ʮRuby ରԠʯͱᨳ͍ͬͯΔ͕ SDK
࣮ preview ൛ • ϝϯςφϯε͞Ε͍ͯΔͱ౸ఈࢥ͑ͳ͍ • GitHub Overview ʹهࡌ͞Ε͍ͯΔαϯϓϧͰ͑͞·ͱʹಈ͔ͳ͍ • υΩϡϝϯτ͕ͳ͍ͷͰ͍ํ͕શ͔͘Βͳ͍
Ruby is Dead in Microsoft Graph https://youtu.be/zb8dXWYUX10
Issues #42 https://github.com/microsoftgraph/msgraph-sdk-ruby/issues/42
Issues #42 https://github.com/microsoftgraph/msgraph-sdk-ruby/issues/42 ࠓޙ։ൃ͕ܧଓ͞ΕΔ͔ෆ໌ྎ
Microsoft Graph SDK for Ruby ʹ ͲͷΑ͏ͳΞϓϩʔν͕Ͱ͖Δ͔ʁ
ͲͷΑ͏ͳΞϓϩʔν͕Ͱ͖Δ͔ʁ • microsoft_grapsh Microsoft ͷͷ • ϝϯςφϯεͯ͠Β͑Δ or Ͱ͖Δ
Ruby SDK ͕ཉ͍͠ • ͳ͍ͳΒࣗ࡞ͪ͠Ό͏ʁ
ࣗ࡞ͷؔ • ΤϯυϙΠϯτ͕େ • طଘͷ࣮͕ղ • OData Protocol • Microsoft
͕ 2007 ʹఏএʢݱࡏ ver. 4.01ʣ • RESTful API ΛΑΓ؆୯ʹѻ͑ΔΑ͏ʹߟ͑ΒΕͨ Φʔϓϯϓϩτίϧ • https://www.odata.org/documentation/
Microsoft Graph νϡʔτϦΞϧ https://docs.microsoft.com/en-us/graph/tutorials/ruby
Microsoft Graph νϡʔτϦΞϧ https://docs.microsoft.com/en-us/graph/tutorials/ruby microsoft_graph ΘΕ͍ͯͳ͍…
ࣗ࡞ͷؔ • ΤϯυϙΠϯτ͕େ • طଘͷ࣮͕ղ • OData Protocol • Microsoft
͕ 2007 ʹఏএʢݱࡏ ver. 4.01ʣ • RESTful API ΛΑΓ؆୯ʹѻ͑ΔΑ͏ʹߟ͑ΒΕͨ Φʔϓϯϓϩτίϧ • https://www.odata.org/documentation/
ࣗ࡞ͷؔ • ΤϯυϙΠϯτ͕େ • طଘΛ౿ऻ͢Δͷ͕ࠔ • OData Protocol • Microsoft
͕ 2007 ʹఏএʢݱࡏ ver. 4.01ʣ • RESTful API ΛΑΓ؆୯ʹѻ͑ΔΑ͏ʹߟ͑ΒΕͨ Φʔϓϯϓϩτίϧ • https://www.odata.org/documentation/ ͬͱָʹࣗ࡞Ͱ͖Δ ํ๏ͳ͍ͩΖ͏͔ʁ
OpenAPI
OpenAPI • ϓϩάϥϛϯάݴޠʹґଘ͠ͳ͍ RESTful API ΠϯλϑΣʔεͷఆٛ • ༷ͷݺশ OpenAPI Specification
• https://github.com/OAI/OpenAPI-Specification • ݱࡏ v. 3.0.2 • چ Swagger specification • ࢀߟɿ https://speakerdeck.com/akihito_nakano/gunmaweb34
OpenAPI Generator • OpenAPI Specification ʹଇͬͯ YAML/JSON ϑΝΠϧΛ࡞͢Ε ͦΕΛجʹ API
Client Λੜͯ͘͠ΕΔπʔϧ • https://github.com/OpenAPITools/openapi-generator • ࢀߟɿ https://rubykaigi.org/2019/presentations/ota42y.html#apr18
OpenAPI Generator • ରԠ͍ͯ͠Δݴޠ͕๛ • વ Ruby ͋Δ https://github.com/OpenAPITools/openapi-generator#overview
OpenAPI Generator • ରԠ͍ͯ͠Δݴޠ͕๛ • વ Ruby ͋Δ https://github.com/OpenAPITools/openapi-generator#overview OpenAPI
Schema ͕͋Ε ΫϥΠΞϯτΛੜͰ͖Δ
microsoft-graph-openapi https://github.com/microsoftgraph/microsoft-graph-openapi
OpenAPI Generator ΛͬͯΈͨ https://github.com/microsoftgraph/microsoft-graph-openapi
OpenAPI Generator ΛͬͯΈͨ https://github.com/microsoftgraph/microsoft-graph-openapi
OpenAPI Generator ΛͬͯΈͨ https://github.com/microsoftgraph/microsoft-graph-openapi
ؾʹͳΔ • ϝιου໊͕ • e.g. get_pet_by_id(pet_id, opts = {})
ݱࡏͷᷤ౻ʢͦͷ̍ʣ • OpenAPI Generator Λར༻͢Δ • OpenAPI Schema ͑͞࡞Εͦͷϝϯς͚ͩͰࡁΉ •
microsoft-graph-openapi 51 ສߦ͋Δ • ϝιου໊͕
ݱࡏͷᷤ౻ʢͦͷ̎ʣ • OpenAPI Generator Λར༻͠ͳ͍ • ຯʹΤϯυϙΠϯτΛҰͭͻͱ࣮ͭ͢Δ • OpenAPI Generator
ͷ࠶ൃ໌ • Ͱ࣌ؒ༗ݶ…
·ͱΊ • Microsoft Graph • αʔϏεͱͯ͠ศར • υΩϡϝϯτ SDK උʢ˞
Ruby Λআ͘ʣ • OpenAPI • ϓϩάϥϛϯάݴޠʹґଘ͠ͳ͍ RESTful API ΠϯλϑΣʔεͷఆٛ • OpenAPI Generator Λ্ख͘׆༻Ͱ͖Ε Microsoft Graph SDK Λ ࠶ൃ໌Ͱ͖ͦ͏ • ࣗ࡞͢ΔಓͲͷಓΛબΜͰἚͷಓ • Microsoft Graph SDK for Ruby ΛͪΌΜͱϝϯςφϯεͯ͘͠ΕΕສࣄղܾ͢Δ…
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠