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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
1.6k
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
660
Fukuoka.rb 2023 年度活動報告
jinroq
0
570
TRICK 2022 に入選した話
jinroq
0
360
RubyKaigiとMicrosoftと私
jinroq
0
310
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
340
Other Decks in Technology
See All in Technology
製造現場での生成AIの活用、およびエージェントAIの実装のあり方、AVEVAの取り組み
iotcomjpadmin
0
210
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
260
From Prompt Engineering to Loop Engineering
shibuiwilliam
1
320
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
0
320
WebGIS AI Agentの紹介
_shimizu
0
600
自分が詳しくない領域でAIを使う #プロヒス2026
konifar
20
8.2k
背中から、背中へ /paying forward to community
naitosatoshi
0
200
Agentic AI 時代のテスト手法: Kiro とはじめるプロパティベーステスト (AWS Summit Japan 2026 | DEV212)
ymhiroki
0
150
作る力から、見極める力へ — AI時代に広がるエンジニアの価値と役割
rince
0
390
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
Kotlin 開発のツラミを爆破した話! / Explode the difficulty of Kotlin dev!
eller86
0
130
AIをフル活用してオンコール機能のプロトタイプを2日で作った話 / Building an AI-Powered On-Call Prototype in Just Two Days
nari_ex
0
160
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Six Lessons from altMBA
skipperchong
29
4.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
220
Game over? The fight for quality and originality in the time of robots
wayneb77
1
210
Agile that works and the tools we love
rasmusluckow
331
22k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
360
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
450
Utilizing Notion as your number one productivity tool
mfonobong
4
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 ΛͪΌΜͱϝϯςφϯεͯ͘͠ΕΕສࣄղܾ͢Δ…
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠